-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(FloatingMenu): conditionally set focus in floating menu on menu open #5489
feat(FloatingMenu): conditionally set focus in floating menu on menu open #5489
Conversation
Deploy preview for carbon-elements ready! Built with commit ef1d9dc |
Deploy preview for carbon-components-react ready! Built with commit 0ec84f6 https://deploy-preview-5489--carbon-components-react.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit ef1d9dc https://deploy-preview-5489--carbon-components-react.netlify.app |
Would it be helpful if we made a dedicated non-modal dialog component to help out with the tooltip use-cases? Would hate to mix up the menu and dialog use-cases between tooltip and overflow menu, similarly it seems like they have enough behavioral differences that we might want to specialize. Happy to chat about this in our Slack channel too if you want to talk approaches 👍 Separately, in terms of API design how do you feel about Reach's |
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.
LGTM 👍 - Good fix for what this PR is addressing (focus management). Thanks @emyarod!
converting the interactive tooltip to a modeless dialog may be interesting, but this PR is focused on keyboard navigation and focus management based on the current behavior of the components inheriting from floating menu. Unless there is a missing requirement (let me know if there is), I see rewriting interactive tooltip to no longer extend floating menu as outside the scope of this PR and the referenced issues WRT the API, the |
@emyarod if I understand correctly, the menu pattern for an overflow menu and the non-modal dialog pattern for our tooltip with interactive content would be distinct behaviors, right? I believe we can't close the issues that are linked for these kinds of tooltips unless we implement that behavior, but let me know if I'm misunderstanding what the reqs are 👍 |
@joshblack from what I can tell based on the descriptions in the referenced issues this PR would fulfill the remaining missing requirements. is there something missing that you're referencing? |
@emyarod I believe if we're saying that we're closing #5488 then we would need the dialog to be rendered in the content flow instead of in a portal otherwise tab order is broken, correct? Separately I think we should all chat (either here or on Slack) to better understand the tooltip requirements because if it is a dialog then, in theory, it should have a focus trap, right? Not sure how being a non-modal dialog change this behavior though. |
@joshblack this PR should handle all of those requirements except for the one about where the tooltip would be rendered. Is the render location an implied requirement (not seeing it in the issue but I assume that's part of the definition of "dialog" then)? but if the reason for that is just for tab order, I believe the changes from #5260 should address that already. It looks like it's still functioning correctly in the uncontrolled tooltip example but broken for the default tooltip so that's just a regression in the current PR that I can address |
@emyarod I would recommend starting a conversation in Slack to go over requirements, I don't think it's clear cut what we need to do for this special kind of tooltip with interactive content and might help to get us all on the same page before moving forward 👍 |
a582b46
to
89ada54
Compare
2d9b487
to
0786687
Compare
df4727b
to
ef1d9dc
Compare
Closes #1264
Closes #5365
Closes #5488
related #4414
depends on #5456
This PR adds keyboard navigation features to our floating menus within the confines of the current component architecture.
Changelog
New
selectorPrimaryFocus
in floating menu to select custom targets (ref fix(Modal): Focus primary actionable button on modal opening carbon-components-react#980)selectorFocusable
constant to help with default focus targeting whenselectorPrimaryFocus
andselectorTabbable
do not select any elements (ref fix(tooltip): focus management with non-interactive elements #4268)Changed
primaryFocus
in OverflowMenuItem (which followed vanilla library pattern) in favor of CCR backwards compatibleselectorPrimaryFocus
Testing / Reviewing
Ensure floating menu contents are keyboard navigable. Ensure keyboard navigation flow in floating menu components is as expected.