mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix Notebook navigation key events triggering incorrectly (#18329)
This commit is contained in:
@@ -133,9 +133,17 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
// We currently have to hook this onto window because the Notebook component currently doesn't support having document focus
|
||||||
|
// 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.
|
||||||
this._register(DOM.addDisposableListener(window, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
this._register(DOM.addDisposableListener(window, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||||
let event = new StandardKeyboardEvent(e);
|
// Make sure that the current active element is an ancestor - this is to prevent us from handling events when the focus is
|
||||||
if (this.isActive() && this.model.activeCell) {
|
// on some other dialog or part of the app.
|
||||||
|
if (DOM.isAncestor(this.container.nativeElement, document.activeElement) && this.isActive() && this.model.activeCell) {
|
||||||
|
const event = new StandardKeyboardEvent(e);
|
||||||
if (!this.model.activeCell?.isEditMode) {
|
if (!this.model.activeCell?.isEditMode) {
|
||||||
if (event.keyCode === KeyCode.DownArrow) {
|
if (event.keyCode === KeyCode.DownArrow) {
|
||||||
let next = (this.findCellIndex(this.model.activeCell) + 1) % this.cells.length;
|
let next = (this.findCellIndex(this.model.activeCell) + 1) % this.cells.length;
|
||||||
@@ -167,9 +175,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
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());
|
||||||
this.initActionBar();
|
this.initActionBar();
|
||||||
|
|||||||
Reference in New Issue
Block a user