@@ -381,15 +381,27 @@ export const FilterPicker = forwardRef(function FilterPicker<T extends object>(
381381 const getSelectedLabels = ( ) => {
382382 const collection = localCollectionState . collection ;
383383
384- // Handle "all" selection - return all available labels
385- if ( selectionMode === 'multiple' && effectiveSelectedKeys === 'all' ) {
384+ // Helper to recursively collect all item labels from collection (including nested in sections)
385+ const collectAllLabels = ( ) : string [ ] => {
386386 const allLabels : string [ ] = [ ] ;
387- for ( const item of collection ) {
388- if ( item . type === 'item' ) {
389- allLabels . push ( item . textValue || String ( item . key ) ) ;
387+
388+ const traverse = ( nodes : Iterable < any > ) => {
389+ for ( const node of nodes ) {
390+ if ( node . type === 'item' ) {
391+ allLabels . push ( node . textValue || String ( node . key ) ) ;
392+ } else if ( node . childNodes ) {
393+ traverse ( node . childNodes ) ;
394+ }
390395 }
391- }
396+ } ;
397+
398+ traverse ( collection ) ;
392399 return allLabels ;
400+ } ;
401+
402+ // Handle "all" selection - return all available labels
403+ if ( selectionMode === 'multiple' && effectiveSelectedKeys === 'all' ) {
404+ return collectAllLabels ( ) ;
393405 }
394406
395407 const selectedSet = new Set (
@@ -403,13 +415,14 @@ export const FilterPicker = forwardRef(function FilterPicker<T extends object>(
403415 const labels : string [ ] = [ ] ;
404416 const processedKeys = new Set < string > ( ) ;
405417
406- // Use collection to get labels for selected items
407- for ( const item of collection ) {
408- if ( item . type === 'item' && selectedSet . has ( String ( item . key ) ) ) {
418+ // Use collection.getItem() to directly retrieve items by key (works with sections)
419+ selectedSet . forEach ( ( key ) => {
420+ const item = collection . getItem ( key ) ;
421+ if ( item ) {
409422 labels . push ( item . textValue || String ( item . key ) ) ;
410423 processedKeys . add ( String ( item . key ) ) ;
411424 }
412- }
425+ } ) ;
413426
414427 // Handle custom values that aren't in the collection
415428 const selectedKeysArr =
0 commit comments