-
Notifications
You must be signed in to change notification settings - Fork 363
chore(dropdown): add split button action example #11753
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
base: main
Are you sure you want to change the base?
chore(dropdown): add split button action example #11753
Conversation
@kmcfaul @thatblindgeye I have created a draft for the example. Let me know of the changes required. |
Preview: https://patternfly-react-pr-11753.surge.sh A11y report: https://patternfly-react-pr-11753-a11y.surge.sh |
There were some a11y issues regarding |
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.
Event handling is not quite ideal in this example.
In other dropdown examples, if I open the menu using the keyboard, i can hit tab and it will close the menu and put focus on the next focusable element on the page (in the docs, that's usually the button)
In the other dropdown examples, I can also click outside the menu and it will close the menu.
I think it's because this new example might be missing the 'onOpenChange' prop.
6073673
to
6adca58
Compare
Yes, it was happening due to the missing |
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.
I'm noticing that if I select an option from the menu (with they keyboard or my mouse) browser focus is not returned to the MenuToggle as it does in other examples.
I think you're also missing the shouldFocusToggleOnSelect
prop
When adding the |
Looks like it's because we're applying the patternfly-react/packages/react-core/src/components/MenuToggle/MenuToggle.tsx Lines 200 to 202 in 31a4c28
Since it's a plain div without any tabindex focus gets lost when trying to focus it, and we end up back at the top of the page when you Tab again. This PR is what added the ref to that div #8024 . @kmcfaul do you recall if we need to have the ref on this wrapper div? Moving it to the An alternative would be possibly having to supply some custom focus logic in the example code, which consumers would then have to also implement. |
Closes #10197
References: