Skip to content

fix(skills): select files on click, add Edit to the row menu (MUL-5654) - #6313

Merged
NevilleQingNY merged 1 commit into
mainfrom
fix/mul-5654-skill-file-row-click
Aug 3, 2026
Merged

fix(skills): select files on click, add Edit to the row menu (MUL-5654)#6313
NevilleQingNY merged 1 commit into
mainfrom
fix/mul-5654-skill-file-row-click

Conversation

@NevilleQingNY

Copy link
Copy Markdown
Collaborator

Fixes MUL-5654.

The bug

Clicking a supporting file in the skill file rail never selected it — it opened the row's action menu instead. Only SKILL.md could be opened, which is why the issue started life as "只有 SKILL.md 能编辑".

The row's trigger widens its hit area with after:absolute after:-inset-1, but the button itself was not positioned. The pseudo-element therefore resolved against the nearest positioned ancestor — the row — and covered it end to end. Absolutely positioned, it painted above the in-flow name button and swallowed every click on the file name; opacity-0 does not opt an element out of hit testing, so the row was dead even before hover. SKILL.md renders in a rail without actions, so it had no overlay and stayed clickable.

Every other widened hit area in the repo (slider.tsx, switch.tsx, checkbox.tsx, radio-group.tsx) sits on an element that is itself relative; this one was the outlier.

Changes

  1. relative on the menu trigger, so the ::after is bounded by the button. Rows select on click again.
  2. The raw segment of the view toggle reads Edit for viewers who may edit. It stays Plain text for read-only viewers rather than promising an edit the page would refuse.
  3. The row menu gains an Edit entry: it opens the file, switches the pane from preview to the editor, and puts the caret at the top of it. Works for the file that is already open too — that path mounts nothing, so focus is driven by a request the page owns rather than by mount-time autoFocus.
  4. SKILL.md keeps the Edit entry and still withholds rename/delete: reservedPath now narrows the menu instead of removing it.

New i18n keys detail.files.mode_edit and file_tree.actions.edit in all four locales.

Verification

  • pnpm exec vitest run in packages/views — 3521 passed (300 files), including locale parity.
  • New unit tests: Edit opens a focused editor for a supporting file and for the already-open file; the caret lands at offset 0; read-only viewers get "Plain text" and no row menus; SKILL.md offers Edit but neither rename nor delete; a class-pairing guard on the trigger (relative + after:absolute).
  • pnpm typecheck — 6/6 tasks pass. eslint packages/views/skills — clean.
  • Real-browser check (headless Chromium, classes read out of the component and compiled with the project's Tailwind): before the fix elementFromPoint over the file name returned the menu trigger and the click landed there; after it, the name button receives clicks on the name and on empty row space, while the glyph and ~4px around it still hit the menu — the widened target the class was there to provide is preserved.

jsdom has no layout or hit testing, which is why the original 51-test suite stayed green through this bug; the unit test added here can only hold the class pairing, so the behavioural check is the browser probe above.

Note for review

Giving SKILL.md a (single-entry) row menu is a small scope addition beyond the literal bug — it comes from the "右键也可以有编辑选项" part of the request. If you would rather the main file keep a bare row, dropping it is a two-line revert.

🤖 Generated with Claude Code

The row's action-menu trigger widens its hit area with `after:absolute
after:-inset-1` but was not itself positioned, so that pseudo-element
resolved against the row — the nearest positioned ancestor — and covered it
end to end. Being absolutely positioned it painted above the in-flow name
button, so every click on a supporting file's name opened the menu instead of
selecting the file, and `opacity-0` never opted the overlay out of hit
testing. Only SKILL.md, rendered without actions, stayed clickable, which
read as "only SKILL.md can be edited". `relative` puts the ::after back
inside the trigger.

Alongside the fix, so the editor is reachable in one gesture:

- the raw segment reads "Edit" for viewers who may edit, and stays "Plain
  text" for read-only viewers rather than offering an edit the page refuses;
- the row menu gains an Edit entry that opens the file, switches the pane to
  the editor and puts the caret at its top — including for the file that is
  already open, which mounts nothing and so cannot rely on mount-time focus;
- SKILL.md keeps that entry and still withholds rename/delete.

Verified in Chromium against the compiled classes: clicking a file name or
empty row space now hits the name button, while the glyph and 4px around it
still hit the menu.

Co-authored-by: multica-agent <github@multica.ai>
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
multica-docs Ready Ready Preview Aug 3, 2026 9:18am

Request Review

@NevilleQingNY
NevilleQingNY merged commit 04c48ca into main Aug 3, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant