File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/compat/src/components/Toolbar Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -124,9 +124,9 @@ export const OverflowPopover: FC<OverflowPopoverProps> = (props: OverflowPopover
124124 } ) ( ) ;
125125
126126 const OverflowPopoverContextProvider = getOverflowPopoverContext ( ) . Provider ;
127+ const visibleChildren = lastVisibleIndex === - 1 ? children : children . slice ( lastVisibleIndex + 1 ) ;
127128
128- const visibleChildren = ( children as ReactElement [ ] )
129- . slice ( lastVisibleIndex )
129+ const filteredChildren = ( visibleChildren as ReactElement [ ] )
130130 // @ts -expect-error: if type is not defined, it's not a spacer
131131 . filter ( ( child ) => child . type ?. displayName !== 'ToolbarSpacer' && isValidElement ( child ) )
132132 . map ( ( item , index , arr ) => {
@@ -193,15 +193,15 @@ export const OverflowPopover: FC<OverflowPopoverProps> = (props: OverflowPopover
193193 onOpen = { handleAfterOpen }
194194 hideArrow
195195 accessibleRole = { accessibleRole }
196- accessibleName = { i18nBundle . getText ( WITH_X_ITEMS , visibleChildren . length ) }
196+ accessibleName = { i18nBundle . getText ( WITH_X_ITEMS , filteredChildren . length ) }
197197 >
198198 < div
199199 className = { classes . popoverContent }
200200 ref = { overflowContentRef }
201201 role = { a11yConfig ?. overflowPopover ?. contentRole }
202202 data-component-name = "ToolbarOverflowPopoverContent"
203203 >
204- { visibleChildren }
204+ { filteredChildren }
205205 </ div >
206206 </ Popover > ,
207207 portalContainer ?? document . body
You can’t perform that action at this time.
0 commit comments