Skip to content

Commit

Permalink
Fixed focus loss of the notebook editor widget when a cell editor was…
Browse files Browse the repository at this point in the history
… unfocused (#13741)

Signed-off-by: Jonah Iden <[email protected]>
  • Loading branch information
jonah-iden authored May 29, 2024
1 parent 7788a58 commit db01846
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/notebook/src/browser/view/notebook-cell-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ export class CellEditor extends React.Component<CellEditorProps, {}> {
this.editor?.setLanguage(language);
}));

this.toDispose.push(this.props.notebookModel.onDidChangeSelectedCell(() => {
if (this.props.notebookModel.selectedCell !== this.props.cell && this.editor?.getControl().hasTextFocus()) {
if (document.activeElement && 'blur' in document.activeElement) {
(document.activeElement as HTMLElement).blur();
}
this.toDispose.push(this.props.notebookModel.onDidChangeSelectedCell(cell => {
if (cell !== this.props.cell && this.editor?.getControl().hasTextFocus()) {
this.props.notebookContextManager.context?.focus();
}
}));
if (!this.props.notebookViewportService || (this.container && this.props.notebookViewportService.isElementInViewport(this.container))) {
Expand Down

0 comments on commit db01846

Please sign in to comment.