Open airjp73 opened 1 month ago
We have the same issue, instead of tabbing through the focusable elements it tabs through the first two elements (like in the video) and then tabs out to the dialog root. In our case we just use the dialog component - no tooltip.
Bug report
Current Behavior
When a tooltip is inside a dialog, tabbing away from the tooltip button moves focus back to the dialog root instead of the next focusable element in the dialog.
In this video made using the reproduction below you can see that, when I tab away from the
Tooltip
button, focus skipsAfter tooltip
entirely and goes straight to the dialog root.At the end of the video, I press Escape before tabbing away from the tooltip. This closes the tooltip and then focus moves as expected.
https://github.com/user-attachments/assets/60f6d249-ca24-43f8-a612-7ec937326f43
Expected behavior
When you press tab while focused on a tooltip button, focus should move to the next focusable element.
Reproducible example
Reproduction in code sandbox
Suggested solution
I'm not familiar enough with the codebase to make a definite suggestion here. It might have something to do with react-focus-lock?
Additional context
When tabbing away from the tooltip button, the
focusout
event that fires does indeed have arelatedTarget
set to the next element in the tab order. So something in the Dialog component is likely listening to that and manually changing the focus.Your environment