Skip to content

fix(web): Tab from Permissions menu keeps focus inside model picker - #47114

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/web-permissions-menu-tab-keeps-focus-in-picker
Dec 2, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/web-permissions-menu-tab-keeps-focus-in-picker

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a keyboard user opens the nested Permissions menu in the model picker and presses Tab, focus escapes to the picker trigger behind the still-open popover instead of staying on a visible control inside it. Permissions: <mode> is the last footer tab stop and Base UI portals MenuPopup outside PopoverPopup, so Tab hits the popover's after-focus-guard from outside and focuses its trigger without closing it.

Change

Handle unmodified Tab on PermissionsMenu's MenuPopup (ComposerModelEffort.tsx) to close only the menu and focus its trigger inside the open picker, so the next Tab closes the picker. Modified Tab is ignored because Shift+Tab already closes the menu and returns to the trigger by default; open/blur handling stays unchanged. In ComposerPermissionsSection.browser.test.tsx, the larger diff moves #46640's Picker fixture to module scope unchanged so the new test reuses it while #46640's case stays unchanged in behavior and passes.

Scope

Web-only bug fix for focus escaping behind an open popover (no issue needed; mobile uses ThreadSettingsSheet.tsx).

Verification

Setup. Ubuntu 26.04, Chromium (Playwright debugging-port input), dark theme, 1280x820, isolated dev state with Replay (dev) (Showcase) and demo-project.

Steps. Focus composer → Tab to Showcase → Enter → Tab to Permissions: Full access → Enter → Tab.

Before (7e2b094714ae) After (ab9ddd7aff82)
Permissions menu open on Full access
Permissions menu open on Full access
Permissions menu open on Full access
Permissions menu open on Full access
After Tab: picker open, focus on Showcase behind it
After Tab: picker open, focus on Showcase behind it
After Tab: menu closed, focus on Full access in picker
After Tab: menu closed, focus on Full access in picker

Links. apps/web/src/components/chat/ComposerModelEffort.tsx, apps/web/src/components/chat/ComposerPermissionsSection.browser.test.tsx.

Not shown.

  • macOS / Windows Electron, Safari, Firefox (tested in Linux Chromium).
  • Hardware OS key events (tested via Playwright debugging-port input and Vitest browser mode).
Automated checks and real-app verification details
  • Real-app checks on 7e2b094714ae (base) vs ab9ddd7aff82 (head) using Playwright debugging-port key events:
    • Replay (dev) (Showcase) thread: base after Tab had popoverCount: 1, menuCount: 0, activeElement: button[aria-label="Showcase"]; head after Tab had popoverCount: 1, menuCount: 0, activeElement: button[aria-label="Permissions: Full access"].
    • New draft thread (Claude Opus 5.5): base escaped to button[aria-label="Claude Opus 5.5, Medium"] with popoverCount: 1; head landed on button[aria-label="Permissions: Full access"] with popoverCount: 1, menuCount: 0.
    • Controls unchanged on head: Tab from closed Permissions: Full access closes the picker (popoverCount: 0) and focuses Start voice input; Shift+Tab from open Permissions menu closes the menu and focuses Permissions: Full access; Tab from the effort column's Context Window: 1M side menu closes only that menu and moves to Standard inside the picker; Arrow keys, Enter, Escape, type-ahead (s → Supervised), and pointer selection all still work.
  • New browser test in ComposerPermissionsSection.browser.test.tsx: failed on 7e2b094714ae (Permissions: Full access did not have focus after Tab) and passed on ab9ddd7aff82 (9/9 tests passing, including the existing effort-shortcut test).
  • Concurrent stress loop: 2 x 100 runs of ComposerPermissionsSection.browser.test.tsx passed 200/200 (0 failures).
  • vp run check:changed 7e2b094714ae86c860590c2961a3f45b4af2613d: format (0.5s), lint (0.8s), knip (7.5s), typecheck (0.5s), test (2 files, 11 tests, 8.9s), react compiler (0.7s) — all passed.

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Dec 1, 2026
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ab9ddd7 and 6e5358d.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The Permissions menu now handles unmodified Tab by closing the menu and restoring focus to its trigger. The browser test fixture moves to module scope, and a new test verifies the behavior.

Changes: Permissions menu Tab handling

Layer / File(s) Summary
Handle Tab and verify focus restoration
apps/web/src/components/chat/ComposerModelEffort.tsx, apps/web/src/components/chat/ComposerPermissionsSection.browser.test.tsx
PermissionsMenu closes on unmodified Tab and returns focus to its trigger. The browser test fixture moves to module scope, and a new test checks focus restoration. Modified Tab combinations and other keys retain existing behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review ab9dd

Pressing Tab in the Permissions menu now closes only that menu and keeps focus inside the open model picker. The change is limited to the web UI and is covered by a new browser test. It is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: unmodified Tab from the nested Permissions menu no longer leaves focus behind the open model picker. It follows the conventional commit format and matches the Composer…
Description check Passed The description follows the template. Problem explains the bug, the expected behavior, and the reproduction steps. Change explains the Tab handling in PermissionsMenu and why modified Tab is ignored. …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: unmodified Tab from the nested Permissions menu no longer leaves focus behind the open model picker. It follows the conventional commit format and matches the ComposerModelEffort.tsx change and the new browser test. It is specific and clear.

Full details: Description check

Explanation

The description follows the template. Problem explains the bug, the expected behavior, and the reproduction steps. Change explains the Tab handling in PermissionsMenu and why modified Tab is ignored. Scope says it is a web-only bug fix and gives the reason no issue is linked. Verification gives focused browser test results, real-app before/after steps with screenshots, and lists what was not tested. The template asks for a linked issue or an explanation for why none is needed. The description gives the explanation, so it passes. The template's agent-model line is present as a Gemini attribution.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4c08096 and ab9ddd7.

Files selected for processing: 2

  • apps/web/src/components/chat/ComposerModelEffort.tsx
  • apps/web/src/components/chat/ComposerPermissionsSection.browser.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 2, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment on both sides: Linux Chromium web client, 1280×800, light theme, fresh synthetic demo project and new-thread composer, Replay (dev) Showcase.

Steps: Click the new-thread composer (Full access); Tab twice to the model picker trigger; Enter; Tab through the picker to Permissions: Full access; Enter; unmodified Tab. On head, Tab once more to exit the picker. Replay (dev) Showcase supplies the model list; no model turn is needed.

Scenario: Tab from Permissions returns to the model picker before exiting

Proven: the scenario fails on base 8d0fb4be8a and passes on head 6e5358d860.

Base 8d0fb4be8a Head 6e5358d860
Result ❌ failed
ASSERTION_FAILED: expect.toBeFocused failed
locator: locator("[data-composer-permissions-trigger]")
expected: focused
observed: default states (match count 1)
✅ passed
permissions menu open Base 8d0fb4be8a: permissions menu open Head 6e5358d860: permissions menu open
tab closes permissions menu Base 8d0fb4be8a: tab closes permissions menu Head 6e5358d860: tab closes permissions menu
failure Base 8d0fb4be8a: failure
next tab exits picker Head 6e5358d860: next tab exits picker

Scenario driver · Before recording · After recording

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 2, 2026
@juliusmarminge
juliusmarminge merged commit 515b8c9 into pingdotgg:main Dec 2, 2026
57 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 2, 2026
imetn added a commit to imetn/t4code that referenced this pull request Dec 2, 2026
Surgically ports 62 upstream Web UI fixes from pingdotgg/t3code
(772e3d4..1e6e7d7) into apps/web and scripts/scenarios while
preserving all 31 locked T4 customizations, T4 branding, and
t4-overrides.css.

Also restores React Compiler compilation for Sidebar by moving the
default new Set(...) parameter inside settleLaunchGroup into the
function body so switching threads produces 0 unaffected row re-renders.

Ported (62 commits):
- 1a08049 (pingdotgg#46481): right-panel launcher keys blocked while context menu open
- 6bdd718 (pingdotgg#46489): Enter restores highlighted stashed prompt (scenario e2e; web code already absorbed)
- 347f551 (pingdotgg#46490): Escape closes open context menu before layer beneath it
- afa3003 (pingdotgg#46487): workflows page uses width of wide window
- a2ba869 (pingdotgg#46485): keep joined emoji whole in screen-reader announcements
- a8ee725 (pingdotgg#46493): holding stash shortcut keeps prompt saved (scenario e2e; web code already absorbed)
- 5048c80 (pingdotgg#46499): Mod+S moves edited queued reply to prompt stash
- 179e6c3 (pingdotgg#46506): holding stash delete shortcut removes one prompt (scenario e2e; web code already absorbed)
- c101437 (pingdotgg#44079): fold PR diff whose header was clicked
- 9b27e5a (pingdotgg#46562): second Mod+T keeps right-panel Add menu shortcuts working
- 62cf1fe (pingdotgg#46592): wait for dialog focus before opening context menu over it
- fda1c30 (pingdotgg#46579): resting on issue row prefetches detail
- 28f0c93 (pingdotgg#46593): slash-command description tooltip closes when modal opens
- 789784b (pingdotgg#46603): keep selected tab in Workflows links
- 2bc37d9 (pingdotgg#46597): / and Mod+F in Settings ignore open context menu
- b21923b (pingdotgg#46640): effort shortcut closes nested Permissions menu in model picker
- a5a39fa (pingdotgg#46641): inline thread details card grows with interface font size
- 36983d6 (pingdotgg#46644): workflow runs open in resizable right panel
- 2ad902f (pingdotgg#46691): Mod+F on PRs page ignores open menu
- 97d727c (pingdotgg#46699): Link pull request dialog closes when leaving thread
- 7a9d213 (pingdotgg#46729): refuse saving edit to deleted project script action
- bdda9ce (pingdotgg#46745): settling open delegated task opens next thread
- 3763606 (pingdotgg#46760): command menu description tooltip closes on composer focus loss
- 00eae4b (pingdotgg#46764): reopen workflow run on first click
- 19094fd (pingdotgg#46765): boring sidebar folder rows offer snooze again
- dec756c (pingdotgg#46766): reopen last workflow run after hiding panel
- 33ce571 (pingdotgg#46777): keep workflow runs open behind tab menus
- a989ee8 (pingdotgg#46779): restore focus after closing workflow run
- 5c42b2e (pingdotgg#46786): reopen closed workflow run tabs
- caec30f (pingdotgg#46792): cancel tab drags when switching threads
- 27cf2cf (pingdotgg#46794): disable empty panel shortcuts as it closes
- d65936e (pingdotgg#46791): reveal all side panel tabs when they fit
- a9daa0b (pingdotgg#46781): right-panel shortcuts ignore presses while menu/dialog open
- 35b6c5f (pingdotgg#46801): dismissing PR checkout toast cancels handoff
- e9da1b0 (pingdotgg#46818): boring sidebar folder row actions keep height and clicks
- 9feac49 (pingdotgg#46855): long PR search preserves grapheme clusters
- acef160 (pingdotgg#46849): find shared voice dictionary by Japanese label
- 19da14d (pingdotgg#46796): scrolled right panel tabs no longer block chat titlebar drag
- 506bc36 (pingdotgg#46853): close guest share and handoff dialogs when leaving thread
- b4fd7ba (pingdotgg#46879): let Escape and app shortcuts pass through terminal font preview
- f5689ae (pingdotgg#46835): long history load errors wrap without timeline horizontal overflow
- 6b64b0c (pingdotgg#46890): focus command dialog popup when search input disabled
- 70c9da7 (pingdotgg#46900): focus PR Author/Labels filter search inputs on keyboard open
- 891bf1a (pingdotgg#46924): late slash results no longer open tooltip after focus leaves
- 80f0f8a (pingdotgg#46930): copying failed message keeps its images
- e9ca942 (pingdotgg#46659): show workflow question kinds only in filter
- aa8c7c7 (pingdotgg#46941): queued message moves to stash only once removed
- 3ea13b6 (pingdotgg#46940): editing answer while image prepares cancels held submit
- a143526 (pingdotgg#46970): pasting copied file over reattach marker no longer reports failure
- b33c330 (pingdotgg#47011): stub addComposerFilesToDraft with new return shape in test
- a0fb9d1 (pingdotgg#46974): Issues Labels/Assignee filters focus search on keyboard open
- cb525f4 (pingdotgg#47029): clicking anywhere on terminal or panel tab activates it
- 498a3b6 (pingdotgg#47022): syncing messages line no longer shifts whole chat
- e903c85 (pingdotgg#47046): pasted messages with thread link keep picture
- 6a13142 (pingdotgg#47013): limit style invalidation during right-panel resize
- cd8961e (pingdotgg#47078): pasting copied file no longer takes preparing screenshot slot
- 8d0fb4b (pingdotgg#47100): stop showing previous Usage period as loading after failure
- 515b8c9 (pingdotgg#47114): Tab from Permissions menu keeps focus inside model picker
- a681dd5 (pingdotgg#47125): middle-clicking file link no longer opens broken tab
- bbde8dc (pingdotgg#44842): use plus icon for project new-thread buttons
- 59af88f (pingdotgg#47105): switching threads no longer re-renders unaffected sidebar rows
- 1e6e7d7 (pingdotgg#47080): Reopen Closed Tab skips workflow runs removed from history

Already absorbed in HEAD (3 commits):
- 20a0e5f (pingdotgg#46927), a684090 (pingdotgg#47026), c557dab (pingdotgg#47076)

Skipped cleanly (3 commits):
- 70224ca (pingdotgg#46712): depends on unported ui/open-popups.tsx (pingdotgg#45341)
- cf475c4 (pingdotgg#47034): depends on unported ui/open-popups.tsx (pingdotgg#45341)
- be3cc6c (pingdotgg#47145): depends on unported fitsWithAllowance/workGroupOverflowAllowance in TimelineWorkGroupRows.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants