GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(session-ui): open file tree position menu with Shift+F10 by usrnk1 · Pull Request #66372 · anomalyco/opencode

Conversation

@usrnk1

@usrnk1 usrnk1 commented Nov 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Follow-up to #66012 to make the Sidebar position context menu reachable via Shift+F10 from the keyboard on macOS Chromium (where Shift+F10 does not emit a native contextmenu event), while keeping the file tree first in DOM and Tab order on both sides.

Summary

  • packages/session-ui/src/v2/components/session-file-panel-v2.tsx: Handle Shift+F10 and ContextMenu on the file tree toggle's SessionFilePanelV2SideMenu only, preventing the default key action and dispatching a contextmenu event anchored below the toggle's inline-start edge (LTR bounds.left, RTL bounds.right). Enter/Space toggling, the filter input, file rows, and DOM/Tab order remain unchanged.
  • patches/@kobalte%[email protected]: Guard Kobalte's deferred tryAutoFocus (dist/chunk/3D6FM2PJ.js, dist/chunk/RFN6X5VH.jsx) when selectionManager already has a focused key, preventing its setTimeout(..., 0) from snapping focus back to the first submenu item (Left) after a fast keyboard move to the second item (Right).
  • packages/app/component-tests/panel-sidebar-side.spec.ts: Add LTR and RTL keyboard regression tests covering Shift+F10 → Escape focus and keyboard ring restoration, moving the tree to the end side and back while expanded and collapsed, Enter still toggling, and Shift+F10 not intercepting the filter input.

Visual

Review story (plugins-review--changes-and-comments, 1280×720, light theme) after focusing Toggle file tree from the keyboard and pressing Shift+F10:

Before (origin/dev):
Before — Shift+F10 on Toggle file tree does not open the menu

After:
After — Shift+F10 on Toggle file tree opens Sidebar position anchored below the toggle

Checks

  • packages/app component tests: panel-sidebar-side.spec.ts 50/50 passed (--workers=2 --repeat-each=10); focus-ring.spec.ts 8/8 passed.
  • packages/ui unit tests: bun test src/navigation/menu 12/12 passed.
  • packages/session-ui unit tests: bun run test 687 passed, 3 skipped, 0 failed.
  • Typecheck: bun run typecheck (36/36 packages) and bun run typecheck:tsc (34/34 packages) passed.
  • Lint & format: oxlint and prettier --check passed with 0 issues on all committed TS/TSX files.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
usrnk1 added 2 commits November 25, 2026 14:29
@usrnk1
fix(ui): keep submenu keyboard focus across deferred autofocus
e7f20ce
@usrnk1
fix(session-ui): open file tree position menu with Shift+F10
1836d29
@github-actions github-actions Bot added the contributor label Nov 25, 2026
opencodejr[bot]
opencodejr Bot reviewed Nov 25, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The approach is sound and narrowly scoped. I couldn't confirm the macOS fix itself: on Linux Chromium the base already opens the menu with Shift+F10, because a native contextmenu fires. The PR's spec passes 5/5 on both the base and the PR. With the PR, Shift+F10 is handled by the new key handler: the native event is suppressed and exactly one synthetic contextmenu is dispatched on the toggle, so nothing fires twice and the menu opens and takes focus. The Kobalte tryAutoFocus guard looks safe. Where Select and Menu.SubTrigger set a focused key before mount, the skipped autofocus would have picked the same key. tsc -b passes for session-ui.

Public API is unchanged.

A quick manual check on macOS Chromium/desktop (Shift+F10 on the toggle, then a fast ArrowRight → ArrowDown in the submenu) would confirm both parts. Two smaller points are inline: the ContextMenu key branch, and the new keyboard tests not failing on the base in Linux CI.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/session-ui/src/v2/components/session-file-panel-v2.tsx Outdated

if (event.defaultPrevented || event.repeat || event.ctrlKey || event.metaKey || event.altKey) return

if (event.key !== "ContextMenu" && (event.key !== "F10" || !event.shiftKey)) return

@opencodejr opencodejr Bot Nov 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Does this need to handle the ContextMenu key too? Where that key exists (Windows/Linux), browsers already send a native contextmenu event. On Windows, Chromium sends it on key up, so the preventDefault() on keydown may not suppress it. In that case the native event would arrive after the menu has opened and taken focus. Limiting this to Shift+F10, the case that's missing on macOS, would avoid that risk.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@usrnk1 usrnk1 Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed in 5bddbe1: the handler now only reacts to Shift+F10. The ContextMenu key already produces a native contextmenu event where it exists, so it no longer needs handling here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencodejr[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

@opencodejr opencodejr Bot Nov 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The handler change is correct. On pr/head, session-file-panel-v2.tsx:101 is now if (event.key !== "F10" || !event.shiftKey) return, so the ContextMenu key goes back to the browser's own contextmenu event, with no risk of a second event on keyup. The filter-input test still checks that Shift+F10 isn't intercepted there.

One problem: the same commit, 5bddbe1, also cut the component test in packages/app/component-tests/panel-sidebar-side.spec.ts from about 70 lines to about 20. The removed parts never used the ContextMenu key, so this fix didn't require removing them. What's gone:

  • RTL: the ltr/rtl loop is gone, and so is the ArrowLeft submenu-open path for RTL. The anchor's rtl() ? bounds.right : bounds.left branch is no longer tested.
  • Focus ring after Escape and after picking a side: both toHaveCSS("outline-style", "solid") checks are removed, along with the keyboard.press("Shift") that put the page in keyboard mode.
  • Enter and collapsed state: nothing checks anymore that Enter still toggles the tree, that Shift+F10 works while the tree is collapsed, or that the tree can be moved back to start.

The PR description still lists all of these as covered. If they were dropped on purpose (for flakiness, say), the description should be updated. If not, you can bring the old test back with git show 1836d298d:packages/app/component-tests/panel-sidebar-side.spec.ts, lines 62–121. It works with the Shift+F10-only handler as is.

I checked this by reading the commits and pr/head. I didn't run the tests, and I didn't change anything in the checkout (the bun.lock change in the working tree isn't mine).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/component-tests/panel-sidebar-side.spec.ts Outdated
}

for (const direction of ["ltr", "rtl"] as const) {
story(`Shift+F10 on the toggle moves the file tree from the keyboard (${direction})`, async ({ mount, page }) => {

@opencodejr opencodejr Bot Nov 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

On Linux Chromium (CI) these two stories pass on the base too: Shift+F10 already produces a native contextmenu there, and I couldn't trigger the Kobalte submenu race either. So they don't guard this fix and mainly add a long keyboard walk-through, twice. I'd cut this down to one short case (for example Shift+F10 on the toggle opens the menu and focus returns to the toggle on Escape), or drop it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@usrnk1 usrnk1 Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Agreed, trimmed in 5bddbe1 (spacing follow-up 9d7b294). The ltr/rtl loop and the collapsed pass are gone, leaving one short story: Shift+F10 opens the menu, Escape returns focus to the toggle, then a keyboard pick through the submenu. I kept that one pick because it exercises the Kobalte submenu autofocus patch. The filter negative check for Shift+F10 is kept.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencodejr[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

@opencodejr opencodejr Bot Nov 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Agreed, the trim looks right, and the pick you kept does catch a regression in the Kobalte patch, though only some of the time.

What I ran (Linux headless Chromium, on a throwaway worktree of pr/head at 9d7b294):

  • With the patch: panel-sidebar-side.spec.ts passed 20/20 (--repeat-each=5).
  • With the patch removed: I took the tryAutoFocus guard out of the installed 3D6FM2PJ.js and RFN6X5VH.jsx. Then the Shift+F10 story failed in two --repeat-each=20 runs: 2/20 in one, and about 5/20 in the other judging by its "15 passed".
    • Failures showed data-sidebar-side as "start" where "end" was expected, or the toggle not focused afterwards.
    • That's the deferred autofocus snapping focus back to Left after the ArrowDown.

So the bot's earlier point that it couldn't trigger the race doesn't hold for the trimmed story. On this setup it catches a regression of the patch about 10–25% of the time per run, not every time. Since it's a race, it can't be made to fail every time without slowing the timing down artificially, so I'd leave it as is.

Nothing to change. I didn't check whether it would fail without the Shift+F10 handler, because Linux Chromium already fires a native contextmenu there, as noted before.

I made no edits to repo/. The worktree is removed, and the bun.lock change in repo/ isn't mine, so I left it alone.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
usrnk1 added 2 commits November 25, 2026 14:40
@usrnk1
fix(session-ui): limit file tree menu key to Shift+F10
5bddbe1
@usrnk1
test(app): fix spacing in sidebar menu spec
9d7b294
@usrnk1

usrnk1 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Re the review summary: both inline points are handled (ContextMenu key branch removed in 5bddbe1, keyboard tests cut down to one short story in 5bddbe1 / 9d7b294). The macOS Shift+F10 and fast ArrowRight → ArrowDown checks cannot be run from this Linux-style harness, so a manual pass on macOS desktop is still worth doing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencodejr[bot]
opencodejr Bot reviewed Nov 25, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Both earlier points are fixed: the handler now responds only to Shift+F10, and the keyboard tests are down to one short story. At the new head the component spec passes 4/4 in headless Chromium on Linux, and tsc -b passes for session-ui. I still can't check the macOS behaviour itself on Linux. A quick manual check on macOS Chromium would confirm it. Public API is unchanged. No new concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@usrnk1
usrnk1 merged commit fd3c9c4 into dev Nov 25, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@usrnk1
usrnk1 deleted the sidebar-menu-shortcut branch November 25, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@usrnk1
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.