File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2650,6 +2650,7 @@ function OpenCommandPaletteDialog(props: {
26502650 scrollCommandPaletteRowIntoView (
26512651 resultListRef . current ,
26522652 resultRows . rowIndexByItemIndex [ 0 ] ?? 0 ,
2653+ true ,
26532654 ) ;
26542655 return ;
26552656 }
@@ -2921,7 +2922,11 @@ function OpenCommandPaletteDialog(props: {
29212922 setHighlightedItemValue ( typeof value === "string" ? value : null ) ;
29222923 const rowIndex = resultRows . rowIndexByItemIndex [ eventDetails . index ] ;
29232924 if ( eventDetails . reason === "keyboard" && rowIndex !== undefined ) {
2924- scrollCommandPaletteRowIntoView ( resultListRef . current , rowIndex ) ;
2925+ scrollCommandPaletteRowIntoView (
2926+ resultListRef . current ,
2927+ rowIndex ,
2928+ eventDetails . index === 0 ,
2929+ ) ;
29252930 }
29262931 } }
29272932 onValueChange = { ( nextQuery , { event } ) => handleQueryChange ( nextQuery , event . target ) }
Original file line number Diff line number Diff line change @@ -78,7 +78,15 @@ export function CommandPaletteResults(props: CommandPaletteResultsProps) {
7878 ) ;
7979}
8080
81- export function scrollCommandPaletteRowIntoView ( list : LegendListRef | null , rowIndex : number ) {
81+ export function scrollCommandPaletteRowIntoView (
82+ list : LegendListRef | null ,
83+ rowIndex : number ,
84+ isFirstItem : boolean ,
85+ ) {
86+ if ( isFirstItem ) {
87+ void list ?. scrollToOffset ( { offset : 0 , animated : false } ) ;
88+ return ;
89+ }
8290 void list ?. scrollIndexIntoView ( {
8391 index : rowIndex ,
8492 animated : false ,
You can’t perform that action at this time.
0 commit comments