Skip to content

fix(site/src): make tooltips with links keyboard and screen reader accessible - #30424

Merged
chrifro merged 5 commits into
mainfrom
a11y-interactive-hover-popovers
Oct 30, 2026
Merged

chrifro merged 5 commits into
mainfrom
a11y-interactive-hover-popovers

Conversation

@chrifro

@chrifro chrifro commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 This PR was created by Coder Agents on behalf of @chrifro.

Tooltips with links in them couldn't be reached by keyboard or screen readers, because the ARIA tooltip pattern doesn't allow interactive content. This adds an opt-in <Tooltip interactive>. It still opens on hover and looks the same, but it also opens on focus, lets Tab move into the content, stays open after a click or Enter, and closes on Escape. Plain tooltips are unchanged.

Fixes DEQ-473 (workspace permissions), DEQ-378 (audit log details) and the rest of DEQ-287 (AI Gateway). It also converts every InfoTooltip help icon and the agent "Troubleshoot" link. Follow-up to #30403.

housekeeping edit by @aqandrew: also fixes DEQ-568, fixes DEQ-522, fixes DEQ-223

Before After
Hover
Tab from ⓘ skips the link focuses the link

Review notes

Why opt-in instead of changing every tooltip: at least 50 of the 152 tooltip triggers are buttons or links with their own action, such as refresh or copy. Interactive mode takes over the trigger's click, uses dialog semantics instead of a description, and changes the Tab order, so applying it to every tooltip would break those triggers. It also can't be chosen automatically, because the content isn't rendered until the tooltip opens. That means a new tooltip with links needs interactive added by hand. A lint rule could enforce that later.

Worth a close look:

  • Focus management: the content is portaled, so the Tab handoff is written by hand: Tab on the trigger moves to the first focusable element in the content, and leaving the content (Tab past the end, Shift+Tab before the start, Esc) returns focus to the trigger so tab order stays intact.
  • Event isolation: the trigger and content stop click and keydown from propagating so clickable table rows don't fire. Ancestors no longer see those events.
  • Wrappers: Tooltip, TooltipTrigger and TooltipContent are now thin wrappers instead of Radix re-exports, so every tooltip goes through them.
  • Not converted: ResourcesChart bars, whose link has to="" and goes nowhere.
Verification
  • New tests in Tooltip.test.tsx cover keyboard order, Escape, hover not stealing focus, and click pinning.
  • pnpm lint is clean, and all 283 unit test files and all 464 Storybook files pass.
  • In a real browser, the Templates help icon behaves as described, and a plain tooltip (footer refresh button) is unchanged.
  • The audit, sharing and AI Gateway call sites are covered by stories only: the dev deployment has no data for them, and AI Gateway is paywalled.

…cessible

Tooltips whose content contains links or buttons used the ARIA tooltip
pattern, which cannot hold interactive content: keyboard users could not
reach the links and screen readers did not expose them.

Add an interactive mode to Tooltip. <Tooltip interactive> renders a
non-modal popover that still opens on hover and looks the same, but also
opens on keyboard focus, lets Tab move into the content, pins open on
click or Enter, and closes on Escape. Plain tooltips are unchanged.

Use it for InfoTooltip and for the workspace sharing indicator, audit and
connection log details, agent warning, and AI Gateway prompt attribution
and AI Governance tooltips.
@linear-code

linear-code Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Keep call-site edits minimal by moving the trigger button reset and focus
ring into the interactive trigger, and leaving TooltipProvider wrappers in
place. Leave the content through the trigger on Tab so the browser
continues the sequence, which removes the custom next-element lookup.
@chrifro
chrifro marked this pull request as ready for review October 7, 2026 08:07
@chrifro
chrifro requested a review from aqandrew October 7, 2026 08:07

@aqandrew aqandrew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Making tooltips with interactive content (links) is a big improvement! Also, making <Tooltip interactive> render a Radix popover is a good call.

At first it seemed like a lot of custom code was added to Tooltip.tsx to accomplish the behavior that Radix popovers have out of the box, e.g., restoring focus when closing with the escape key. But the click-trigger-to-pin behavior is a nice touch; I played around with this locally and it feels right. 🙂

I have some suggestions and questions re: intent conveyed by var names and comments. Could you address those please?

Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
Comment thread site/src/components/Tooltip/Tooltip.tsx Resolved
@chrifro
chrifro requested a review from aqandrew October 29, 2026 09:26
…r-popovers

# Conflicts:
#	site/src/components/Tooltip/Tooltip.tsx
#	site/src/pages/ConnectionLogPage/ConnectionLogRow/ConnectionLogRow.tsx
@chrifro
chrifro merged commit 22281e8 into main Oct 30, 2026
28 of 29 checks passed
@chrifro
chrifro deleted the a11y-interactive-hover-popovers branch October 30, 2026 08:59
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants