GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — fix(session-ui): open file tree position menu with Shift+F10 by usrnk1 · Pull Request #66372 · anomalyco/opencode Conversation
|
|
|
||
| if (event.defaultPrevented || event.repeat || event.ctrlKey || event.metaKey || event.altKey) return | ||
|
|
||
| if (event.key !== "ContextMenu" && (event.key !== "F10" || !event.shiftKey)) return |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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:
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.toHaveCSS("outline-style", "solid") checks are removed, along with the keyboard.press("Shift") that put the page in keyboard mode.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.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| 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 }) => { |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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):
panel-sidebar-side.spec.ts passed 20/20 (--repeat-each=5).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".
data-sidebar-side as "start" where "end" was expected, or the toggle not focused afterwards.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.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.