Skip to content

Commit

Permalink
Column filter settings: improve semantics (item radio)
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Nov 30, 2023
1 parent cae086c commit 47b5e6b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions packages/edit-site/src/components/dataviews/view-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const {
DropdownMenuV2: DropdownMenu,
DropdownMenuGroupV2: DropdownMenuGroup,
DropdownMenuItemV2: DropdownMenuItem,
DropdownMenuCheckboxItemV2: DropdownMenuCheckboxItem,
DropdownMenuSeparatorV2: DropdownMenuSeparator,
DropdownSubMenuV2: DropdownSubMenu,
DropdownSubMenuTriggerV2: DropdownSubMenuTrigger,
Expand Down Expand Up @@ -202,12 +201,12 @@ function HeaderMenu( { dataView, header } ) {
return (
<DropdownMenuItem
key={ element.value }
role="menuitemradio"
prefix={
isActive && (
<Icon icon={ check } />
)
}
role="menuitemradio"
onSelect={ () => {
dataView.setColumnFilters( [
...otherFilters,
Expand Down Expand Up @@ -235,12 +234,14 @@ function HeaderMenu( { dataView, header } ) {
</DropdownSubMenuTrigger>
}
>
<DropdownMenuCheckboxItem
<DropdownMenuItem
key="in-filter"
value={ OPERATOR_IN }
checked={
role="menuitemradio"
prefix={
filterInView?.operator ===
OPERATOR_IN
OPERATOR_IN && (
<Icon icon={ check } />
)
}
onSelect={ () =>
dataView.setColumnFilters( [
Expand All @@ -255,13 +256,15 @@ function HeaderMenu( { dataView, header } ) {
}
>
{ __( 'Show matches' ) }
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem
</DropdownMenuItem>
<DropdownMenuItem
key="not-in-filter"
value={ OPERATOR_NOT_IN }
checked={
role="menuitemradio"
prefix={
filterInView?.operator ===
OPERATOR_NOT_IN
OPERATOR_NOT_IN && (
<Icon icon={ check } />
)
}
onSelect={ () =>
dataView.setColumnFilters( [
Expand All @@ -276,7 +279,7 @@ function HeaderMenu( { dataView, header } ) {
}
>
{ __( 'Hide matches' ) }
</DropdownMenuCheckboxItem>
</DropdownMenuItem>
</DropdownSubMenu>
) }
</WithSeparators>
Expand Down

0 comments on commit 47b5e6b

Please sign in to comment.