Should we expose IShell.activeWidget
, or short-circuit in IShell.activateById
?
#14883
Labels
api-change
A change that should be accompanied by a major version increase
enhancement
status:Needs Discussion
Problem
Extensions may want to activate a widget if it is not active. This is because activating a widget may have side effects. In case of notebooks the side effect of ensuring focus can lead to problematic behaviour in CodeMirror editor extensions, such as jupyterlab-vim. In jupyterlab-contrib/jupyterlab-vim#85 I workaround it by comparing the widget with
IShell.currentWidget
but it feels like we should be comparing againstIShell.activeWidget
; however that is not exposed as public API.Proposed Solution
a) expose
IShell.activeWidget
,b) short-circuit in
IShell.activateById
if provided id is equalIShell.activeWidget.id
Downsides:
Additional context
Implementation has
activateById
,activeWidget
, andcurrentWidget
:jupyterlab/packages/application/src/shell.ts
Lines 499 to 505 in e2cdaf1
jupyterlab/packages/application/src/shell.ts
Lines 547 to 552 in e2cdaf1
jupyterlab/packages/application/src/shell.ts
Lines 743 to 746 in e2cdaf1
Public API only exposes
activateById
andcurrentWidget
:jupyterlab/packages/application/src/frontend.ts
Lines 242 to 251 in e2cdaf1
jupyterlab/packages/application/src/frontend.ts
Lines 270 to 277 in e2cdaf1
The text was updated successfully, but these errors were encountered: