Skip to content

fix: prevent full width switch from stealing menu focus - #1741

Merged
Lampese merged 2 commits into
mainfrom
codex/menu-pointer-highlight
Oct 19, 2026
Merged

Lampese merged 2 commits into
mainfrom
codex/menu-pointer-highlight

Conversation

@Lampese

@Lampese Lampese commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Related issue

Same-repository UI bug fix reported by the user.

Problem / pressure

Clicking the session header's ⋯ button highlighted Full width while the pointer was still on the trigger. Its nested switch was the first tabbable descendant, so the menu's initial focus selected the switch and highlighted the containing row.

Summary

Keep the trailing switch outside the tab order so the menu row owns keyboard navigation. Pointer opening focuses the menu surface without preselecting an action; keyboard opening, hover, row activation, and direct switch clicks remain available. The preference changes only on activation, and the menu stays open when it is toggled.

Visual explanation

SessionHeaderMenu
└─ Menu.Content       ← receives initial focus on pointer opening
   └─ Full width row  ← keyboard navigation and activation
      └─ Switch       ← tabIndex=-1; still directly clickable

Pointer-opened session menu

The screenshot uses the existing synthetic Storybook fixture. It omits optional Share and owner-transfer callbacks; the production entries and their visibility conditions are unchanged.

Before / after

Before After
Opening with the mouse immediately highlighted Full width. No action is highlighted until pointer hover or keyboard navigation.
The nested switch could claim initial focus. The menu row owns keyboard navigation; both row and switch still toggle once without dismissing the menu.

Test plan

  • Passed: NODE_ENV=test pnpm --filter @lody/components exec vitest run tests/session-header-menu.test.tsx tests/conversation-wide-mode.test.tsx — 15 tests.
  • Passed: browser checks against the real SessionHeaderMenu Storybook component for pointer opening, keyboard opening, hover, row activation, direct switch clicks, and Escape dismissal.
  • Passed: pnpm format.
  • Passed: pnpm check — workspace type checking, typed and Effect lint, all configured workspace tests, i18n validation, and boundary guards.
  • pnpm run docs check reports six pre-existing missing Kimi/Pi submodule links in the bilingual subagent-events note; no new broken links or protected-topic changes.

Context handoff

This is a focused fix on a same-repository branch. The owning session README and bilingual bug-fix note document the focus boundary and verification. Optional menu actions, their callbacks, and capability checks are unchanged.

Keep the nested switch outside the tab order so pointer openings focus
the menu surface and keyboard navigation remains on its rows. Cover
pointer and keyboard openings plus row and switch activation.

Model: gpt-6.1-sol
@Lampese
Lampese marked this pull request as ready for review October 19, 2026 22:53
@Lampese
Lampese merged commit 258c326 into main Oct 19, 2026
16 checks passed
@Lampese
Lampese deleted the codex/menu-pointer-highlight branch October 19, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant