Skip to content

Trap keyboard focus within published search - #4567

Open
jpreynat wants to merge 2 commits into
mainfrom
jpreynat/fix-search-modal-focus-trap
Open

Trap keyboard focus within published search#4567
jpreynat wants to merge 2 commits into
mainfrom
jpreynat/fix-search-modal-focus-trap

Conversation

@jpreynat

Copy link
Copy Markdown
Member

What changed

  • Keep keyboard focus inside desktop published search while its results are open, wrapping from the final visible popup control back to the search input and in the other direction with Shift+Tab.
  • Track the asynchronously mounted portaled popup so the input and results behave as one focus region even though they live in separate DOM trees.
  • Leave mobile unchanged because its side sheet already traps focus.

This fixes RND-12430. It adds no dependency; the added production source is about 835 bytes gzip before minification as a conservative upper bound.

Testing

  • Added a Playwright regression covering both Tab boundaries against the live local preview: 1 passed.
  • bun run typecheck: 27/27 tasks passed.
  • Focused lint, formatting, and git diff --check: passed.

A patch changeset is included.

@linear-code

linear-code Bot commented Aug 31, 2026

Copy link
Copy Markdown

RND-12430

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7f5cb9e

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

This PR includes changesets to release 1 package
Name Type
gitbook 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

@argos-ci

argos-ci Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2-cloudflare (Inspect) ⚠️ Changes detected (Review) 2 changed, 2 ignored Aug 31, 2026, 10:36 PM
customers-v2-vercel (Inspect) ⚠️ Changes detected (Review) 1 changed, 5 ignored Aug 31, 2026, 10:34 PM
v2-cloudflare (Inspect) ✅ No changes detected 1 ignored Aug 31, 2026, 10:38 PM
v2-vercel (Inspect) ✅ No changes detected 8 ignored Aug 31, 2026, 10:37 PM

@github-actions

Copy link
Copy Markdown
Contributor

Style invalidation on a large API reference

Elements restyled by opening one popup on the Snyk API reference. A share near or above 100% means the insertion restyles the whole document.

interaction restyled page share budget
openapi-select 6 10,730 0.1% 25%
search 631 10,730 5.9% 125%

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