Skip to content

Commit

Permalink
Menu: use ariakit types (#68206)
Browse files Browse the repository at this point in the history
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent 2e590d0 commit f78c60c
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 66 deletions.
3 changes: 2 additions & 1 deletion packages/components/src/menu/checkbox-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const MenuCheckboxItem = forwardRef<
HTMLDivElement,
WordPressComponentProps< MenuCheckboxItemProps, 'div', false >
>( function MenuCheckboxItem(
{ suffix, children, hideOnClick = false, ...props },
{ suffix, children, disabled = false, hideOnClick = false, ...props },
ref
) {
const menuContext = useContext( MenuContext );
Expand All @@ -37,6 +37,7 @@ export const MenuCheckboxItem = forwardRef<
ref={ ref }
{ ...props }
accessibleWhenDisabled
disabled={ disabled }
hideOnClick={ hideOnClick }
store={ menuContext.store }
>
Expand Down
11 changes: 10 additions & 1 deletion packages/components/src/menu/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ export const MenuItem = forwardRef<
HTMLDivElement,
WordPressComponentProps< MenuItemProps, 'div', false >
>( function MenuItem(
{ prefix, suffix, children, hideOnClick = true, store, ...props },
{
prefix,
suffix,
children,
disabled = false,
hideOnClick = true,
store,
...props
},
ref
) {
const menuContext = useContext( MenuContext );
Expand All @@ -37,6 +45,7 @@ export const MenuItem = forwardRef<
ref={ ref }
{ ...props }
accessibleWhenDisabled
disabled={ disabled }
hideOnClick={ hideOnClick }
store={ computedStore }
>
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/menu/radio-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const MenuRadioItem = forwardRef<
HTMLDivElement,
WordPressComponentProps< MenuRadioItemProps, 'div', false >
>( function MenuRadioItem(
{ suffix, children, hideOnClick = false, ...props },
{ suffix, children, disabled = false, hideOnClick = false, ...props },
ref
) {
const menuContext = useContext( MenuContext );
Expand All @@ -44,6 +44,7 @@ export const MenuRadioItem = forwardRef<
ref={ ref }
{ ...props }
accessibleWhenDisabled
disabled={ disabled }
hideOnClick={ hideOnClick }
store={ menuContext.store }
>
Expand Down
Loading

1 comment on commit f78c60c

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in f78c60c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12465232898
📝 Reported issues:

Please sign in to comment.