@@ -62,6 +62,8 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
6262 protected _extents = new Map < INotebookModel , NotebookPresenter . TExtentMap > ( ) ;
6363 protected _layers = new Map < INotebookModel , NotebookPresenter . TLayerMap > ( ) ;
6464
65+ private _windowingModeBackup : 'defer' | 'full' | 'none' = 'full' ;
66+
6567 constructor ( options : NotebookPresenter . IOptions ) {
6668 this . _manager = options . manager ;
6769 this . _commands = options . commands ;
@@ -95,6 +97,13 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
9597 }
9698 this . _removeStyle ( panel ) ;
9799 panel . content . activeCellChanged . disconnect ( this . _onActiveCellChanged , this ) ;
100+
101+ // restore the windowing mode of the notebook.
102+ panel . content . notebookConfig = {
103+ ...panel . content . notebookConfig ,
104+ windowingMode : this . _windowingModeBackup
105+ } ;
106+
98107 panel . update ( ) ;
99108
100109 const { activeCell } = panel . content ;
@@ -111,6 +120,14 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
111120
112121 public async start ( panel : NotebookPanel ) : Promise < void > {
113122 const { model, content : notebook } = panel ;
123+
124+ // Switch to not windowing mode
125+ this . _windowingModeBackup = notebook . notebookConfig . windowingMode ;
126+ notebook . notebookConfig = { ...panel . content . notebookConfig , windowingMode : 'none' } ;
127+ // Force viewport properties that may not be properly set, depending on lab version.
128+ notebook . viewportNode . style . minHeight = '' ;
129+ ( notebook . viewportNode . parentNode as HTMLDivElement ) . style . height = '' ;
130+
114131 if ( model ) {
115132 const _watchPanel = async ( change : any ) => {
116133 /* istanbul ignore if */
@@ -312,7 +329,7 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
312329 this . _commands . addKeyBinding ( {
313330 command : CommandIds [ direction ] ,
314331 keys : DIRECTION_KEYS [ direction ] ,
315- selector : `.${ CSS . deck } .jp-Notebook.jp-mod-commandMode:focus` ,
332+ selector : `.${ CSS . deck } .jp-Notebook.jp-mod-commandMode:not(.jp-mod-readWrite) : focus` ,
316333 } ) ;
317334 }
318335 for ( const [ directions , keys ] of COMPOUND_KEYS . entries ( ) ) {
@@ -321,7 +338,7 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
321338 command : CommandIds . go ,
322339 args : { direction, alternate } ,
323340 keys,
324- selector : `.${ CSS . deck } .jp-Notebook.jp-mod-commandMode:focus` ,
341+ selector : `.${ CSS . deck } .jp-Notebook.jp-mod-commandMode:not(.jp-mod-readWrite) : focus` ,
325342 } ) ;
326343 }
327344 }
@@ -518,6 +535,9 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
518535 if ( this . _manager . layover ) {
519536 this . _manager . layover . model . parts = onScreen ;
520537 }
538+
539+ // Force the focus on the new active cell.
540+ notebook . activeCell ?. node . focus ( ) ;
521541 }
522542
523543 protected _forceStyle ( ) {
0 commit comments