File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
extensions/notebook-renderers/src Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -198,13 +198,25 @@ function onScrollHandler(e: globalThis.Event) {
198
198
}
199
199
}
200
200
201
+ function onKeypressHandler ( e : KeyboardEvent ) {
202
+ if ( e . ctrlKey || e . shiftKey ) {
203
+ return ;
204
+ }
205
+ if ( e . code === 'ArrowDown' || e . code === 'End' || e . code === 'ArrowUp' || e . code === 'Home' ) {
206
+ // These should change the scroll position, not adjust the selected cell in the notebook
207
+ e . stopPropagation ( ) ;
208
+ }
209
+ }
210
+
201
211
// if there is a scrollable output, it will be scrolled to the given value if provided or the bottom of the element
202
212
function initializeScroll ( scrollableElement : HTMLElement , disposables : DisposableStore , scrollTop ?: number ) {
203
213
if ( scrollableElement . classList . contains ( scrollableClass ) ) {
204
214
scrollableElement . classList . toggle ( 'scrollbar-visible' , scrollableElement . scrollHeight > scrollableElement . clientHeight ) ;
205
215
scrollableElement . scrollTop = scrollTop !== undefined ? scrollTop : scrollableElement . scrollHeight ;
206
216
scrollableElement . addEventListener ( 'scroll' , onScrollHandler ) ;
207
217
disposables . push ( { dispose : ( ) => scrollableElement . removeEventListener ( 'scroll' , onScrollHandler ) } ) ;
218
+ scrollableElement . addEventListener ( 'keydown' , onKeypressHandler ) ;
219
+ disposables . push ( { dispose : ( ) => scrollableElement . removeEventListener ( 'keydown' , onKeypressHandler ) } ) ;
208
220
}
209
221
}
210
222
You can’t perform that action at this time.
0 commit comments