check find widget is not focused (#18506)

* remove logic to check that the find widget is visible
This commit is contained in:
Barbara Valdez
2022-03-02 16:57:37 -08:00
committed by GitHub
parent 87f1e26e39
commit 8b543d1d12

View File

@@ -141,15 +141,12 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
// on its elements (we have a "virtual" focus that is updated as users click or navigate through cells). So some of the keyboard // on its elements (we have a "virtual" focus that is updated as users click or navigate through cells). So some of the keyboard
// events we care about are fired when the document focus is on something else - typically the root window. // events we care about are fired when the document focus is on something else - typically the root window.
this._register(DOM.addDisposableListener(window, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => { this._register(DOM.addDisposableListener(window, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
// For DownArrow, UpArrow and Enter - Make sure that the current active element is an ancestor - this is to prevent us from handling events when the focus is // For DownArrow, UpArrow, Enter, Escape (unselecting active cell) - Make sure that the current active element is an ancestor - this is to prevent us from handling events when the focus is
// on some other dialog or part of the app. // on some other dialog or part of the app.
// For Escape - the focused element is the div.notebook-preview or textarea.inputarea of the cell, so we need to make sure that it is a descendant of the current active cell // For Escape (exiting edit mode)- the focused element is the div.notebook-preview or textarea.inputarea of the cell, so we need to make sure that it is a descendant of the current active cell
// on the current active editor. // on the current active editor.
const activeCellElement = this.container.nativeElement.querySelector(`.editor-group-container.active .notebook-cell.active`); const activeCellElement = this.container.nativeElement.querySelector(`.editor-group-container.active .notebook-cell.active`);
const findWidgetVisible = !!document.querySelector(`.editor-widget.find-widget.visible`);
let handled = false; let handled = false;
// check that the find widget is not opened before handling notebook cell events
if (!findWidgetVisible) {
if (DOM.isAncestor(this.container.nativeElement, document.activeElement) && this.isActive() && this.model.activeCell) { if (DOM.isAncestor(this.container.nativeElement, document.activeElement) && this.isActive() && this.model.activeCell) {
const event = new StandardKeyboardEvent(e); const event = new StandardKeyboardEvent(e);
if (!this.model.activeCell?.isEditMode) { if (!this.model.activeCell?.isEditMode) {
@@ -188,7 +185,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
if (handled) { if (handled) {
DOM.EventHelper.stop(e); DOM.EventHelper.stop(e);
} }
}
})); }));
this._register(this.themeService.onDidColorThemeChange(this.updateTheme, this)); this._register(this.themeService.onDidColorThemeChange(this.updateTheme, this));
this.updateTheme(this.themeService.getColorTheme()); this.updateTheme(this.themeService.getColorTheme());