-
Notifications
You must be signed in to change notification settings - Fork 4.6k
MenuItem: make accessible when disabled #71251
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,7 @@ function UnforwardedMenuItem( | |
| role={ role } | ||
| icon={ iconPosition === 'left' ? icon : undefined } | ||
| className={ className } | ||
| accessibleWhenDisabled | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so — since Moreover, this change aligns with other menu impementations:
In short, I don't think consumers should (or would) set a menu item as non-accessible while disabled.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for confirming 👍 |
||
| { ...buttonProps } | ||
| > | ||
| <span className="components-menu-item__item">{ children }</span> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, the bug fixed by this PR doesn't occur when using
DropdownMenu'scontrolsprop (as opposed to using thechildrenprop).That is because
DropdownMenuinternally doesn't useMenuItemwhen mapping over thecontrolsprop, but uses theButtoncomponent directly and sets theaccessibleWhenDisabledprop already:gutenberg/packages/components/src/dropdown-menu/index.tsx
Lines 205 to 209 in 15bff41
I would typically work on refactoring
DropdownMenuto useMenuIteminternally, but it's probably not worth it given that we already have a newerMenucomponent, and the upcoming DS effort