Skip to content

fix(tooltip): use popover="manual" so tooltips coexist with open popovers - #6595

Open
rubencarvalho wants to merge 14 commits into
mainfrom
rcarvalho/fix-tooltip-popover-coexistence
Open

fix(tooltip): use popover="manual" so tooltips coexist with open popovers#6595
rubencarvalho wants to merge 14 commits into
mainfrom
rcarvalho/fix-tooltip-popover-coexistence

Conversation

@rubencarvalho

@rubencarvalho rubencarvalho commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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 to popover="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

  • Added three coexistence tests: opening a tooltip over an open popover, opening a popover over a visible tooltip, and a tooltip on a control nested inside an open popover.
  • Updated stale assertions/comments that assumed popover="auto".
  • Tooltip suite 33/33 (Vitest); a11y 18/18 across Chromium/Firefox/WebKit — including trusted-Escape close under manual.

Accessibility testing checklist

  • Keyboard
    1. Open components-tooltip--overview; focus the trigger with Tab.
    2. Confirm the tooltip appears on focus and Escape closes it; focus stays on the trigger.
  • Screen reader
    1. Focus the trigger; confirm the tooltip text is announced as its description (role="tooltip" wired via aria-describedby).
    2. Open an <swc-popover>, then hover a tooltipped control; confirm the popover is not dismissed and both remain available.

…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.
@rubencarvalho
rubencarvalho requested a review from a team as a code owner August 7, 2026 14:11
@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b05cafc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@adobe/spectrum-wc Patch
@adobe/spectrum-wc-core Patch

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

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 Gen1 Visual Regression Test Results

When 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: pr-6595

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@coveralls

coveralls commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 31730939228

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Warning

No base build found for commit 81a47a6 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 96.241%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 39268
Covered Lines: 37993
Line Coverage: 96.75%
Relevant Branches: 6464
Covered Branches: 6020
Branch Coverage: 93.13%
Branches in Coverage %: Yes
Coverage Strength: 460.58 hits per line

💛 - Coveralls

@rubencarvalho rubencarvalho added the Status:WIP PR is a work in progress or draft label Aug 7, 2026
rubencarvalho and others added 4 commits August 7, 2026 17:21
… 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.
@rubencarvalho
rubencarvalho marked this pull request as draft August 7, 2026 15:49
rubencarvalho and others added 4 commits August 7, 2026 21:11
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.
@rubencarvalho rubencarvalho added Component:Tooltip Component:Popover Status:Ready for review PR ready for review or re-review. gen2 These issues or PRs map to our 2nd generation work to modernizing infrastructure. and removed Status:WIP PR is a work in progress or draft labels Aug 12, 2026
@rubencarvalho
rubencarvalho requested a review from 5t3ph August 12, 2026 13:08
@rubencarvalho
rubencarvalho marked this pull request as ready for review August 12, 2026 13:08
…-popover-coexistence

# Conflicts:
#	2nd-gen/packages/core/components/tooltip/Tooltip.base.ts

@5t3ph 5t3ph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to patch the behavior auto was helping provide of closing previous tooltips when others in close proximity are opened, and fixing the close timer logic as well.

Image

rubencarvalho and others added 2 commits August 13, 2026 20:28
popover="manual" removed the native auto singleton that dismissed a
sibling tooltip when a new one opened, leaving the first tooltip stranded
open when hovering from one trigger to the next. Restore the singleton
explicitly in TooltipBase: one tooltip open at a time.
@rubencarvalho
rubencarvalho requested a review from 5t3ph August 19, 2026 09:17
@rubencarvalho

Copy link
Copy Markdown
Contributor Author

We'll need to patch the behavior auto was helping provide of closing previous tooltips when others in close proximity are opened, and fixing the close timer logic as well.

Image

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component:Popover Component:Tooltip gen2 These issues or PRs map to our 2nd generation work to modernizing infrastructure. Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants