@@ -106,6 +106,12 @@ export interface FilteredActionListProps extends Partial<Omit<GroupedListProps,
106106 * Default is false.
107107 */
108108 focusPrependedElements ?: boolean
109+ /**
110+ * Determines the scroll behavior of the container when an item is focused.
111+ *
112+ * @default 'auto'
113+ */
114+ scrollBehavior ?: ScrollBehavior
109115}
110116
111117export function FilteredActionList ( {
@@ -136,6 +142,7 @@ export function FilteredActionList({
136142 disableSelectOnHover = false ,
137143 setInitialFocus = false ,
138144 focusPrependedElements,
145+ scrollBehavior,
139146 ...listProps
140147} : FilteredActionListProps ) : JSX . Element {
141148 const [ filterValue , setInternalFilterValue ] = useProvidedStateOrCreate ( externalFilterValue , undefined , '' )
@@ -258,8 +265,11 @@ export function FilteredActionList({
258265 activeDescendantFocus : inputRef ,
259266 onActiveDescendantChanged : ( current , previous , directlyActivated ) => {
260267 activeDescendantRef . current = current
261- if ( current && scrollContainerRef . current && directlyActivated ) {
262- scrollIntoView ( current , scrollContainerRef . current , menuScrollMargins )
268+ if ( current && scrollContainerRef . current && ( directlyActivated || focusPrependedElements ) ) {
269+ scrollIntoView ( current , scrollContainerRef . current , {
270+ ...menuScrollMargins ,
271+ behavior : scrollBehavior ,
272+ } )
263273 }
264274
265275 onActiveDescendantChanged ?.( current , previous , directlyActivated )
@@ -276,10 +286,10 @@ export function FilteredActionList({
276286 if ( activeDescendantRef . current && scrollContainerRef . current ) {
277287 scrollIntoView ( activeDescendantRef . current , scrollContainerRef . current , {
278288 ...menuScrollMargins ,
279- behavior : 'auto' ,
289+ behavior : scrollBehavior ,
280290 } )
281291 }
282- } , [ items , inputRef , scrollContainerRef ] )
292+ } , [ items , inputRef , scrollContainerRef , scrollBehavior ] )
283293
284294 useEffect ( ( ) => {
285295 if ( usingRovingTabindex ) {
0 commit comments