spectrum-web-components
spectrum-web-components copied to clipboard
[Bug]: Clicking on open & self-managed tooltip in action-button triggers button
Code of conduct
- [X] I agree to follow this project's code of conduct.
Impacted component(s)
ActionButton, Tooltip
Expected behavior
Clicking on an open (self-managed) tooltip should not trigger a click on the button itself
Actual behavior
Clicking on an open (self-managed) tooltip triggers a click on the button itself
Screenshots
No response
What browsers are you seeing the problem in?
No response
How can we reproduce this issue?
- Go to https://opensource.adobe.com/spectrum-web-components/components/tooltip/#self-managed-overlays
- Hover over button
- Click on tooltip
- See button reaction
Sample code that illustrates the problem
No response
Logs taken while reproducing problem
No response
It would be even better if tooltip hides when user moves mouse out of button over tooltip - as it logically shouldn't trigger any pointerover or hover events when the mouse is NOT over the origin sp-action-button anymore.
It's a requirement of delivering tooltip content accessibly that the pointer can enter the temporary content. We'd definitely accept a contribution that stopped propagation of click events on <sp-tooltip self-managed> elements.
While we could add an event.stopPropagation() on click events from inside tooltip when self-managed I still see a greater issue with tooltips and overlay trigger.
As "self-managed" tooltip are slotted into buttons and "belong to the trigger element" they will be always visible when the user still hovers "out" of the real button UI and over the tooltip UI.
I assume this can't be solved with the current setup.
I thought there might be a solution where a tooltip can be rendered as sibling next to the trigger button - and connected / related with the for attribute such as with sp-field-labels.
<sp-button id="trigger">My button</sp-button>
<sp-tooltip for="trigger" self-managed ... >My related tooltip</sp-tooltip>
We probably need to discuss with a11y team about the reasons tooltips should stay open when hovered over them.