-
Notifications
You must be signed in to change notification settings - Fork 37
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
Tooltip appear on its own after closing a Modal. #916
Comments
Hello @mathieu-fournier, This is expected behavior, because after modal is closed, focus is returned to the previously focused element. And of course, as a result, tooltip appears. |
Hi @veekeys o/, I am displaying a button bar on the top of the page. Adding a label instead of a tooltip on each button would take too much horizontal space. I inspected the button and no focus event is triggered on it when closing the button. Thanks (: |
"focus-back" is a common accessibility pattern for keyboard users, to preserve their position in the tab order. This is the expected flow:
It is not enough to look to popular sites as examples, because a lot of them are inaccessible. Ideally, the fix here would be to only show tooltip on focus for keyboard users, so that mouse users are unaffected. But that might not be achievable, which is why we asked for more details on your use case to see if it was valid. But your use case seems valid, so we would need to research this a bit more to find a better fix. |
Hey @mayank99 o/, I just found a workaround. I think it might break the accessibility pattern tho. |
This comment was marked as outdated.
This comment was marked as outdated.
update: this is still not fixed in v3 (after #1231 and #1311). one difference i noticed is the tooltip doesn't show up when pressing esc to close the modal. https://codesandbox.io/s/itwinui-react-modal-tooltip-demo-forked-rvl7rl?file=/src/AModalBtn.tsx also the workaround discussed above is not screenreader-friendly. a generic wrapper |
After confirming in the latest version of v3 (3.8.1) (sandbox), clicking the close button also now no longer re-shows the tooltip. Screen-recordingEnregistrement.de.l.ecran.2024-04-04.a.3.42.05.PM.movAnd as @mayank99 mentioned, pressing the Esc also does not re-show the tooltip: Screen-recordingEnregistrement.de.l.ecran.2024-04-04.a.3.46.05.PM.movThe case where it does not work is when the keyboard focus is on the Screen-recordingEnregistrement.de.l.ecran.2024-04-04.a.3.51.00.PM.movIn the future, we would likely also try to cover this third case. But for now, since the main two cases are covered, I believe we can close this issue. Feel free to reopen it if you feel differently. |
Describe the bug (actual behavior)
A tooltip wrapping a Button that opens a Modal will re-appear when closing the modal.
Image taken after the modal is closed:
Expected behavior
The tooltip should not re-appear since the cursor is no longer on the button.
Reproduction
Link to a minimal repro:
https://codesandbox.io/s/itwinui-react-modal-tooltip-demo-l88z9
Steps to reproduce
The text was updated successfully, but these errors were encountered: