Skip to content

fix(a11y): add focusin/focusout to saved-query nav hover tooltip (WCAG 2.1.1)#3453

Open
bilal-karim wants to merge 1 commit into
mainfrom
a11y/2.1.1-saved-query-nav-hover-tooltip
Open

fix(a11y): add focusin/focusout to saved-query nav hover tooltip (WCAG 2.1.1)#3453
bilal-karim wants to merge 1 commit into
mainfrom
a11y/2.1.1-saved-query-nav-hover-tooltip

Conversation

@bilal-karim
Copy link
Copy Markdown
Member

@bilal-karim bilal-karim commented May 26, 2026

Summary

The saved-query nav rail and its standalone-activities sibling render query buttons with mouse-only tooltip handlers. When the rail is collapsed, query-button labels are truncated — mouse users see the full label in the floating tooltip but keyboard users tabbing through the rail see only icons.

This PR adds onfocusin / onfocusout alongside the existing mouse handlers so the same onQueryBtnEnter / onQueryBtnLeave callbacks fire on keyboard focus. Handler signatures widen from MouseEvent to MouseEvent | FocusEvent.

   <div
     class="w-full"
     role="menuitem"
     tabindex="-1"
     onmouseenter={(e) => onQueryBtnEnter(e, view.name)}
     onmousemove={onQueryBtnMove}
     onmouseleave={onQueryBtnLeave}
+    onfocusin={(e) => onQueryBtnEnter(e, view.name)}
+    onfocusout={onQueryBtnLeave}
   >

How it works

  • focusin / focusout bubble from descendants (unlike focus / blur)
  • The wrapper has tabindex="-1" (not itself a focus stop); focus on the inner <Button> bubbles to the wrapper where the handlers are attached
  • e.currentTarget resolves to the wrapper for both mouse and focus events, so positionTooltipFrom(el) computes the same bounding rect either way
  • The existing if ($savedQueryNavOpen) return; guard short-circuits when the nav is expanded, so no tooltip is shown on focus when the inline label is sufficient (matches today's mouse-side behavior)

Audit context

  • WCAG 2.2 SC 2.1.1 Keyboard (Level A) — Medium remediation priority.
  • Pattern matches existing precedent in 3 Holocene table-body-cell components (workflows, activities, workers) that already pair onmouseover with onfocusin for hover-OR-focus UI reveal.

Test plan

  • Collapse the saved-query nav (workflows page, saved-views drawer). Tab through each query-button. The floating tooltip should appear next to the focused button with the full (untruncated) name.
  • Tab order is unchanged — only the inner <Button> is a focus stop; the wrapper stays tabindex="-1".
  • Repeat on saved-views.svelte (standalone activities surface).
  • Expand the nav and Tab through again — no tooltip should appear (inline label is sufficient; matches today's mouse behavior).
  • Mouse hover still shows and hides the tooltip identically to today (regression check).
  • Screen reader smoke test: confirm <Button> accessible name continues to announce normally.

Out of scope

🤖 Generated with Claude Code

…G 2.1.1)

The saved-query nav rail (saved-query-views.svelte) and its
standalone-activities sibling (saved-views.svelte) render query
buttons inside wrappers with mouse-only handlers
(onmouseenter/onmousemove/onmouseleave). When the rail is
collapsed, query-button labels are truncated; mouse users see
the full label in the floating tooltip but keyboard users
tabbing through the rail see only the icons.

Add onfocusin/onfocusout alongside the existing mouse handlers
so the same onQueryBtnEnter/onQueryBtnLeave callbacks fire on
keyboard focus. focusin/focusout bubble from descendants -- the
wrapper has tabindex=-1 so focus on the inner <Button> bubbles
to the wrapper where the handlers are attached.

Widens handler signatures to MouseEvent | FocusEvent. Pattern
matches the established mouse+focus pairing in three Holocene
table-body-cell consumers (workflows, activities, workers).

Existing $savedQueryNavOpen guard preserved -- expanded nav
state shows no tooltip on focus (matching today's mouse
behavior).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bilal-karim bilal-karim requested a review from a team as a code owner May 26, 2026 01:09
@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
holocene Ready Ready Preview, Comment May 26, 2026 1:10am

Request Review

@temporal-cicd
Copy link
Copy Markdown
Contributor

temporal-cicd Bot commented May 26, 2026

Warnings
⚠️

📊 Strict Mode: 4 errors in 2 files (0.4% of 908 total)

src/lib/components/standalone-activities/saved-views.svelte (1)
  • L153:25: Argument of type 'string | undefined' is not assignable to parameter of type 'string | number | boolean'.
src/lib/pages/saved-query-views.svelte (3)
  • L397:8: 'view.count' is possibly 'undefined'.
  • L404:51: 'view.count' is possibly 'undefined'.
  • L151:25: 'activeQueryView' is possibly 'undefined'.

Generated by 🚫 dangerJS against c46b8b9

@bilal-karim
Copy link
Copy Markdown
Member Author

Warnings
⚠️
📊 Strict Mode: 4 errors in 2 files (0.4% of 908 total)

src/lib/components/standalone-activities/saved-views.svelte (1)

  • L153:25: Argument of type 'string | undefined' is not assignable to parameter of type 'string | number | boolean'.

src/lib/pages/saved-query-views.svelte (3)

  • L397:8: 'view.count' is possibly 'undefined'.
  • L404:51: 'view.count' is possibly 'undefined'.
  • L151:25: 'activeQueryView' is possibly 'undefined'.

Generated by 🚫 dangerJS against c46b8b9

Pre-existing errors

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant