Repository navigation
fix: let overlays handle presses and Tab on tooltip anchors - #303
Merged
Merged
Conversation
Contributor
Author
|
Updated in
There is no runtime change. |
l4u532
force-pushed
the
fix/tooltip-dismiss-layer
branch
from
November 30, 2026 09:04
8ee87fd to
eb6c723
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr
Reproduction
Open Options, hover Add until its tooltip shows, then click Add.
For the consuming case, replace Dropdown Menu with
TableMenu. PassariaLabel="Options",trigger="Options", and one Rename item.The touch reproduction uses a staged setup because touch has no hover. Tapping Add to show the tooltip would close an open menu. Open the menu, then mount the Tooltip with
defaultOpenon a short timer. Wait for its bubble to appear, then tap Add.Browser verification
Captured on 2026-11-29. Playwright read the menu state and count in Chrome. Safari on an iPhone 17 Pro simulator exposed the menu item and count in its accessibility tree.
40e138ae)c0944430)Chrome mouse, Chrome touch emulation and iPhone Safari touch gave the same menu and count results. On upstream, the first press hides the tooltip and the second closes the menu.
Chrome mouse. The fixed table menu closes with the count at zero.
iPhone Safari touch. The closing tap leaves the count at zero. The next tap dismisses the tooltip and adds one.
Before #292. Both menus closed. Table Menu already let the first press through.
Chrome chart and keyboard. A press on a Treemap tile left the dropdown open on upstream. With the patch, it closes. Tab from Close panel in Center Morph Modal moved focus out of the document on upstream. With the patch, it returns to Save inside the modal.
Cause and scope
Tooltip now passes the bubble as the shared
useDismisshook's optionallayerRef. Other overlays use that element for outside presses and focus traps. The ref matches the hook's existing DOM boundary API. The tooltip still checks both the anchor and bubble for its own dismissal.Since #292,
useDismissreturns early for a press in a layer opened above the current overlay. Tooltip had registered both the bubble and anchor in its layer. Even before #292,inOtherLayerused that boundary when deciding whether to consume the click.The tooltip's capture listener must leave anchor presses to the trigger. That gives the trigger's
pointerdownhandler time to record that the tooltip was open. Using the bubble for both boundaries made the second tap reopen the tooltip in Chrome touch emulation.The same boundary applies to chart tooltips whose anchor is the whole plot. It also keeps focus traps from treating a focused tooltip trigger as part of a newer layer.
Chrome and iPhone Safari confirmed that pressing the portaled bubble still keeps its containing popover open, as intended by #292. Ordinary two-tap tooltip toggling passed in both. At 375 px with reduced motion, Chrome showed the tooltip on Tab to Add and dismissed it on Escape. Desktop Safari mouse, keyboard and reduced motion remain unverified.
The Tooltip code applies cleanly alongside #299, which covers inert anchors. Both PRs edit Tooltip's accessibility paragraph and the registry dates, so the second to merge needs a small rebase.
Test plan
MorphPopoverContent, wrap a button in a Tooltip. Open the popover, tap that button to show its tooltip, then tap the bubble. The popover stays open.TreemapPreview. Open the menu, hover a tile until its tooltip shows, then click the tile. The menu closes.bun run checkandbun test. Both passed with 196 registry components and 239 accessibility tests.