Repository navigation
[trees] Keep context menu closable when the same row reopens it - #1188
Merged
Merged
Conversation
Right-clicking the row whose menu is already open (same path and source) keeps the same slot menu and its close() closure, but each open issued a new token. closeContextMenu then rejected that menu's close() as stale, so consumer actions such as Radix onOpenChange(false) could not close it. Add nextContextMenuToken(), which reuses the open menu's token when the path and source match and issues a new token otherwise. Use it for the row and trigger-button open paths. Add a regression test that right-clicks the same row twice and closes the menu with its close(). Also remove an unnecessary type assertion in the #945 test that fails type-aware oxlint on main. Follow-up to #945. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S8sCGahM5K2sY4efY2hWUM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
SlexAxton
marked this pull request as ready for review
October 13, 2026 14:29
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Requested by Alex Sexton · Slack thread
Description
Before: If you right-click a row whose context menu is already open, the menu stays on screen, but its
close()stops working. Consumer actions such as RadixonOpenChange(false)cannot close it. Only Escape or an outside click closes it. Also, type-aware oxlint fails onmainafter #945, so the "Build, test, lint" check is red.After: A second right-click on the same row keeps the menu open, and that menu's
close()still closes it. The lint check onmainpasses again.How: Each open issued a new token. But the slot effect is keyed on
path::source, so for the same row it keeps the old menu and its oldclose(), which carries the old token.closeContextMenuthen rejected thatclose()as stale. The newnextContextMenuToken()helper inFileTreeView.tsxreuses the open menu's token when the path and source match. It issues a new token in all other cases. The row path and the trigger-button path both use it. I did not add the token to the effect key, because that re-runsrender()and replaces the menu DOM (see the comment aboveactiveContextMenuKey). In the #945 test,return menu as unknown as HTMLElement;is nowreturn menu;. This fixes thetypescript(no-unnecessary-type-assertion)error that makesmainred.Motivation & Context
This is a follow-up to #945 (#945). It fixes the valid post-merge Codex review comment (#945 (comment)). It also fixes the red lint on
main(merge commit14c110c).Type of changes
first discussed with the dev team and they should be aware that this PR is
being opened
You must have first discussed with the dev team and they should be aware
that this PR is being opened
Checklist
contributing guidelines
moon run root:lint)moon run root:format)moonx diffs:test)Verification (moon could not load its toolchain plugin in this sandbox, so I ran the task commands directly):
bun testinpackages/trees: 329 pass, 0 fail. The new test fails without the fix and passes with it.tsc --noEmit --prettyinpackages/trees: pass.oxlint --type-aware --tsconfig tsconfig.oxlint.json packages: pass.oxfmt --checkon the changed files: pass.How was AI used in generating this PR
Claude Code found the cause, wrote the fix and the regression test, and ran the checks above. A human should review it.
Related issues
🤖 Generated with Claude Code
https://claude.ai/code/session_01S8sCGahM5K2sY4efY2hWUM
Generated by Claude Code