@@ -14,6 +14,7 @@ export default class extends Controller {
1414 hasNestedNavigation : { type : Boolean , default : false } ,
1515 preventHandledKeys : { type : Boolean , default : false } ,
1616 autoSelect : { type : Boolean , default : true } ,
17+ autoScroll : { type : Boolean , default : true } ,
1718 onlyActOnFocusedItems : { type : Boolean , default : false }
1819 }
1920
@@ -80,10 +81,10 @@ export default class extends Controller {
8081
8182 await nextFrame ( )
8283
83- this . currentItem . scrollIntoView ( { block : "nearest" , inline : "nearest" } )
84+ if ( this . autoScrollValue ) { this . currentItem . scrollIntoView ( { block : "nearest" , inline : "nearest" } ) }
8485 if ( this . hasNestedNavigationValue ) { this . #activateNestedNavigableList( ) }
8586
86- if ( ! skipFocus && this . focusOnSelectionValue ) { this . currentItem . focus ( ) }
87+ if ( ! skipFocus && this . focusOnSelectionValue ) { this . currentItem . focus ( { preventScroll : ! this . autoScrollValue } ) }
8788 }
8889
8990 isSelected ( item ) {
@@ -160,7 +161,7 @@ export default class extends Controller {
160161 #relayNavigationToParentNavigableList( event ) {
161162 const parentController = this . #parentNavigableListController
162163 if ( parentController ) {
163- parentController . element . focus ( )
164+ parentController . element . focus ( { preventScroll : ! this . autoScrollValue } )
164165 parentController . navigate ( event )
165166 }
166167 }
0 commit comments