fix(tooltip): use popover="manual" so tooltips coexist with open popovers - #6595
fix(tooltip): use popover="manual" so tooltips coexist with open popovers#6595rubencarvalho wants to merge 11 commits into
Conversation
…vers Tooltip used popover="auto", so opening a tooltip on hover light-dismissed any other open auto popover — including an <swc-popover> the user was still working in. Switch to popover="manual" so the tooltip is not part of the auto light-dismiss group; it coexists with an open popover in both directions. Escape and close-on-leave are already handled internally, so nothing is lost by dropping native light-dismiss.
🦋 Changeset detectedLatest commit: a1e5c1b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch Preview Links🔍 Gen1 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Coverage Report for CI Build 31215116937Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage remained the same at 96.239%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
… surface first With popover="manual", a tooltip open on top of an <swc-popover> was not part of any Escape-ordering coordination: one Escape triggered both the tooltip's own handler and the browser's native auto-popover light-dismiss, closing both surfaces at once. Register the tooltip in the shared dismissible stack while open, and move its Escape handler to the capture phase gated on isTopDismissible(). When the tooltip is topmost it now preventDefault()s the native popover dismiss and stopPropagation, so the first Escape closes only the tooltip and leaves the popover the user is working in open; a second Escape closes the popover. This matches the pattern Popover already uses. - add register/unregister + capture-phase gated handleKeyDown - synthetic guard EscapeClosesTopmostTooltipTest (vitest) - trusted-input ordering test in tooltip.a11y.spec.ts - update changeset, tooltip.mdx, migration-guide.mdx
… orders Replace the single trusted-input Escape test with a data-driven pair covering both open orders (popover-then-tooltip and tooltip-then-popover). Each opens the two surfaces in a fixed order and asserts Escape dismisses them in reverse (LIFO): the topmost closes first and every surface below it stays open, then the next Escape closes the following one. Also drop em dashes from the touched comments per the style guide.
The ci-a11y Storybook builds `*.stories.ts` but not the `.test.ts` fixtures, so the a11y spec's `tooltip-tests--coexists-*` story ids never existed there and gotoStory timed out waiting for the custom element. Add a hidden CoexistenceWithPopover fixture (popover + tooltip in one iframe, `!test` so the automatic axe run skips it) to tooltip.stories.ts and point both ordering tests at it; they differ only in which surface opens last.
Tooltip used
popover="auto", so opening a tooltip on hover light-dismissed any other open auto popover — including an<swc-popover>the user was still working in. Switching topopover="manual"takes the tooltip out of the native auto light-dismiss group, so a hover tooltip and an open popover now coexist in both directions.Escape and close-on-leave are already handled internally by the component, so nothing is lost by dropping native light-dismiss. This also restores the Spectrum 1
type="hint"isolation behavior.Tests
popover="auto".manual.Accessibility testing checklist
components-tooltip--overview; focus the trigger with Tab.role="tooltip"wired viaaria-describedby).<swc-popover>, then hover a tooltipped control; confirm the popover is not dismissed and both remain available.