File tree Expand file tree Collapse file tree
src/components/dataviews-filters Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212- DataForm: Fix focus loss when collapsing in Card view. [ #75689 ] ( https://github.com/WordPress/gutenberg/pull/75689 )
1313- DataViews: Avoid flickering while refreshing. [ #74572 ] ( https://github.com/WordPress/gutenberg/pull/74572 )
1414- DataViews: Fix spacing in first column. [ #75693 ] ( https://github.com/WordPress/gutenberg/pull/75693 )
15+ - DataViews: Fix filter toggle flickering when there are locked or primary filters. [ #75913 ] ( https://github.com/WordPress/gutenberg/pull/75913 )
1516- DataViews: Remove visual divider between quick and regular actions in the actions menu. [ #75893 ] ( https://github.com/WordPress/gutenberg/pull/75893 )
1617- DataForm: field label for panel layout are no longer uppercased. [ #75944 ] ( https://github.com/WordPress/gutenberg/pull/75944 )
1718
Original file line number Diff line number Diff line change @@ -31,13 +31,13 @@ function FiltersToggle() {
3131 } ,
3232 [ onChangeView , setIsShowingFilter ]
3333 ) ;
34- const visibleFilters = filters . filter ( ( filter ) => filter . isVisible ) ;
3534
36- const hasVisibleFilters = ! ! visibleFilters . length ;
3735 if ( filters . length === 0 ) {
3836 return null ;
3937 }
4038
39+ const hasVisibleFilters = filters . some ( ( filter ) => filter . isVisible ) ;
40+
4141 const addFilterButtonProps = {
4242 label : __ ( 'Add filter' ) ,
4343 'aria-expanded' : false ,
@@ -54,12 +54,19 @@ function FiltersToggle() {
5454 setIsShowingFilter ( ! isShowingFilter ) ;
5555 } ,
5656 } ;
57+ // When there are primary or locked filters, the filter bar is always
58+ // visible and cannot be hidden, so the toggle button should be disabled.
59+ const hasPrimaryOrLockedFilters = filters . some (
60+ ( filter ) => filter . isPrimary || filter . isLocked
61+ ) ;
5762 const buttonComponent = (
5863 < Button
5964 ref = { buttonRef }
6065 className = "dataviews-filters__visibility-toggle"
6166 size = "compact"
6267 icon = { funnel }
68+ disabled = { hasPrimaryOrLockedFilters }
69+ accessibleWhenDisabled
6370 { ...( hasVisibleFilters
6471 ? toggleFiltersButtonProps
6572 : addFilterButtonProps ) }
You can’t perform that action at this time.
0 commit comments