-
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(Tooltip): allow focusTrap prop passthrough #6722
feat(Tooltip): allow focusTrap prop passthrough #6722
Conversation
3796d1f
to
71b0ac5
Compare
Deploy preview for carbon-elements ready! Built with commit 910423a |
Deploy preview for carbon-components-react ready! Built without sensitive environment variables with commit 910423a https://deploy-preview-6722--carbon-components-react.netlify.app |
Would the intended behavior here be that if the dialog doesn't trap focus (nonmodal dialog) that it should stay in tab order? Similarly, if we are using Side-note, would this be a good candidate for revisiting with the nested roles? (tooltip -> dialog) |
yes it should stay in tab order when the focus trap behavior is disabled. we can remove the role attribute when the focus trap is disabled if that's what you mean. and yes this should probably be a use case to consider in those discussions (I'm out of the loop on what explorations have been done) |
Honestly there hasn't been much outside of conversations on PRs like this one haha
Makes sense, was trying to reproduce in the storybook but was having trouble tabbing into the content:
I believe if we have something with |
I'm not sure about how your example looks but there is an uncontrolled tooltip example in the storybook. This prop was only meant to be disabled in the uncontrolled component scenario, since by default we are trapping focus right? To avoid that confusion I guess we can remove the prop from the default story maybe. As for the role attribute, what would be the verdict on that? it sounds like it should be removed when focus trap is disabled |
@emyarod just was noting that for this story (which I think is the uncontrolled one) that when |
right that's what I was referring to with my earlier comment
this prop is only relevant in the controlled example so should I just remove it entirely from the uncontrolled example? |
Got it, sounds good! Sorry about the confusion 😄 |
@emyarod I was unsure if you wanted to add anything else to this PR. Looks good on my end, merge when ready 👍 |
85fc253
to
9a937ec
Compare
Closes #6719
Related #6458
This PR allows users to set the
focusTrap
prop on Tooltikps to passthrough to the underlyingFloatingMenu
. A check for thefocusTrap
prop is also added to theFloatingMenu
to prevent moving focus away from tooltip trigger elementsChangelog
New
focusTrap
prop onTooltip
to control the underlyingFloatingMenu
Changed
focusTrap
prop before calling focus method inFloatingMenu
Testing / Reviewing
Confirm that tooltips do not steal focus away from focusable trigger elements when
focusTrap
is false