Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropdownMenuV2: use the Icon component to render radio checks #55964

Merged
merged 2 commits into from Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@

- `Tabs`: Add `focusable` prop to the `Tabs.TabPanel` sub-component ([#55287](https://github.com/WordPress/gutenberg/pull/55287))
- `Tabs`: Update sub-components to accept relevant HTML element props ([#55860](https://github.com/WordPress/gutenberg/pull/55860))
- `DropdownMenuV2`: Fix radio menu item check icon not rendering correctly in some browsers ([#55964](https://github.com/WordPress/gutenberg/pull/55964))

### Enhancements

Expand Down
15 changes: 7 additions & 8 deletions packages/components/src/dropdown-menu-v2-ariakit/index.tsx
Expand Up @@ -99,6 +99,12 @@ export const DropdownMenuCheckboxItem = forwardRef<
);
} );

const radioCheck = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Circle cx={ 12 } cy={ 12 } r={ 3 }></Circle>
</SVG>
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make that one an official icon in our icon library maybe? cc @jasmussen


export const DropdownMenuRadioItem = forwardRef<
HTMLDivElement,
WordPressComponentProps< DropdownMenuRadioItemProps, 'div', false >
Expand All @@ -119,14 +125,7 @@ export const DropdownMenuRadioItem = forwardRef<
store={ dropdownMenuContext?.store }
render={ <Styled.ItemPrefixWrapper /> }
>
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<Circle
cx={ 12 }
cy={ 12 }
r={ 3 }
fill="currentColor"
></Circle>
</SVG>
<Icon icon={ radioCheck } size={ 24 } />
</Ariakit.MenuItemCheck>
{ children }
{ suffix }
Expand Down