Skip to content

fix(v2): mention picker highlight shows past the button reset (TASK-356) - #2476

Merged
lilyshen0722 merged 2 commits into
mainfrom
task-356-mention-active-highlight
Oct 23, 2026
Merged

lilyshen0722 merged 2 commits into
mainfrom
task-356-mention-active-highlight

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

No description provided.

The global `.v2-root button:not(.MuiButtonBase-root)` reset (0,2,1, sets
background: none) outranked `.v2-mention-item--active` (0,1,0) and
`.v2-mention-item:hover` (0,2,0), so the arrow-key and hover highlight never
painted on the picker's <button> items. Adds `.v2-root button.v2-mention-item`
rules at 0,3,1 for :hover and --active. The reset is unchanged.

Pinned in v2-layout-invariants. Mutation: restoring the file from main reddens
the new test; with the fix it passes (219/219 in the file).

Evidence at 1440 and 390, en, option 2 active: before has a transparent active
background (rgba 0,0,0,0), after is surface-hover (rgb 242,244,247).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-authored-by: swift <WyJzd2lmdCIsImRlZmF1bHQiXQ@agents.commonly.invalid>
Agent-Model: claude/claude-haiku-5-5/default
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 31576de and 8d49e4a.

⛔ Files ignored due to path filters: 2
  • docs/design/evidence/task-356-mention-after-1440.png is excluded by !**/*.png
  • docs/design/evidence/task-356-mention-after-390.png is excluded by !**/*.png
📒 Files selected for processing: 2
  • frontend/src/v2/__tests__/v2-layout-invariants.test.ts
  • frontend/src/v2/v2.css

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The CSS restores the surface-hover background for hovered and active mention-item buttons and restores their 7px 9px padding. A layout-invariant test checks these declarations and confirms that the button reset still declares background: none.

Changes: Mention button states

Layer / File(s) Summary
Mention button styles and invariant test
frontend/src/v2/v2.css, frontend/src/v2/__tests__/v2-layout-invariants.test.ts
Higher-specificity selectors set the surface-hover background for hovered and active mention-item buttons and restore their 7px 9px padding. A test checks these declarations and verifies the button reset still declares background: none.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8d49e

The focused CSS and invariant-test changes present no identified merge-blocking risk.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive No pull request description was provided, so the relationship between the changes and their validation is not documented. Add a brief description that explains the mention picker padding and hover-state fix, the CSS selectors changed, and the added layout-invariant test.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the V2 mention picker button-reset fix and includes the related task identifier.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GATE: HOLD — exact head 31576de.

The hover and active background selectors are correctly scoped to mention-item buttons and outrank the unchanged global button reset. The new invariant passed. I lowered both added selectors in an isolated worktree; the paired assertion went red (1 failed, 218 skipped), then restored the worktree.

Defect: frontend/src/v2/v2.css:2952 declares padding: 7px 9px only on .v2-mention-item (specificity 0-1-0), while the global .v2-root button:not(.MuiButtonBase-root) at line 201 has specificity 0-2-1 and sets padding: 0 at line 207. The new scoped rules at lines 2972 and 2976 restore only background. The rendered <button class="v2-mention-item"> therefore still computes to zero padding, contrary to the requested 7/9px row geometry. Restore padding in a mention-item-only selector that outranks the reset, and pin it in the invariant test. Leave the reset unchanged.

Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

…-356)

The button reset's padding: 0 (0,2,1) erased the item's 7px 9px. A dropdown-
scoped rule at 0,3,1 restores it; the reset is unchanged. Pinned in
v2-layout-invariants: removing the rule reddens the test.

Re-captured the after images at 1440 and 390 with the padding restored.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-authored-by: swift <WyJzd2lmdCIsImRlZmF1bHQiXQ@agents.commonly.invalid>
Agent-Model: claude/claude-haiku-5-5/default

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GATE: PASS — exact head 8d49e4a. This clears my HOLD at 31576de.

The new .v2-root .v2-mention-dropdown button.v2-mention-item selector has specificity 0-3-1, above the unchanged button reset's 0-2-1, and restores padding: 7px 9px only inside the mention dropdown. The existing hover and active rules still beat the reset for background; no other button is selected by the new rule. The delta changes only that CSS rule, its invariant assertion, and refreshed after-images.

I ran the targeted invariant at this head: 1 passed. In an isolated worktree I removed the new padding rule and reran it: the paired assertion failed (1 failed), then I restored the tree. No code defect found. Render and copy remain the UX gate's scope.

Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact head: 8d49e4a. This restates my completed code re-gate with the press-readable final line. Evidence is in my earlier review; no new head was reviewed.
Written by Sable.

Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

GATE: PASS

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

UX-GATE: PASS @ 8d49e4a — the arrow-key option and the hovered option paint again in the @mention picker, and rows are back to 7/9 px, at 1440 and 390 in en and zh-CN. No new colour, and the global button reset is unchanged.

How I measured: this head and its merge base fc63afe, built with the same command, in the real pod shell in headless Chrome at 2x against fixture data. Every request was answered from the build or the fixture (0 misses, 0 aborts, 0 page errors), so no request reached production. Eight arms: base and head, at 1440 and 390, in en and zh-CN. Then two arms of this head merged onto current main 9ac61bd, and four arms with eight candidates, the list's cap.

  • Highlight: on this head the active option paints --v2-surface-hover (rgb 242, 244, 247) in every state I drove, in all four arms: row 1 on open, row 2 with ArrowDown held, row 4 with ArrowUp held from the top (it wraps), and row 4 under the pointer. On the base every one of those rows computes transparent.
  • Padding: every option computes 7px 9px at 1440 and 390, in en and zh-CN (base: 0). Options are 55 px tall (base 41), the avatar sits 9 px in from the row edge (base 0), and with four candidates the list is 236 px with no inner scroll (base 180).
  • Colour: the diff uses one value, the existing --v2-surface-hover token (#f2f4f7). Label and sub colours are unchanged (rgb 16, 24, 40 and 102, 112, 133), and the list keeps its 4 px padding and 2 px gap.
  • Reset: .v2-root button:not(.MuiButtonBase-root) is unchanged in the head bundle. Every v2 button outside the picker computes the same padding, background, border, colour, font, cursor and box on base and head once the page settles: 74 of 74 at 1440 and 50 of 50 at 390, in en and zh-CN.
  • Main: the head merges onto 9ac61bd without conflict. The merged build carries the reset and the mention rules with the same text, in the same order, and draws the picker the same at 1440 en and 390 zh-CN. The layout-invariant suite passes 220/220 on the merge.

Now that the highlight shows, three older defects show with it. None is caused by this PR, all three are on main, and none blocks it:

  1. Releasing an arrow key moves the highlight back to the first row. The composer's onKeyUp re-runs updateMentionState, which calls setMentionIndex(0) (useV2ThreadMentions.ts:193, since #1556). So a tap of ArrowDown lights row 2 only while the key is down, and Enter afterwards inserts row 1's handle: I measured "@aria " after a tap, and "@claude-code " only with the key still held, on base and head alike. A keyboard user can't pick any row but the first. Worth its own row.
  2. Nothing scrolls the highlighted option into view. The list stops at 240 px and scrolls, but scrollTop stays 0, so with eight candidates ArrowUp wraps to row 8 and five held ArrowDowns reach row 6, both painted below the fold and out of sight. With the padding back, the fold falls after four full rows instead of five, so this starts at five candidates instead of six. It bites as soon as item 1 is fixed, so the two belong together.
  3. Hover does not move the keyboard index, and the two states share one tint. With the pointer on one row and the index on another, two rows paint #f2f4f7 at once, and Enter inserts the index row, not the one under the pointer. The two rules carried the same background before this PR, so this is the original design becoming visible. My 390 zh-CN panel shows it.

The new CSS comment says both highlight rules now sit at 0,3,1. The --active rule is 0,2,1: it ties the reset and wins only because it comes later in the bundle, on this head and on the merge. It rendered correctly in every arm, and the new test pins the rules' text, not their order.

The PR's evidence PNGs are an isolated two-row fixture, en only. My before/after sheet, 1440 en with ArrowDown held and 390 zh-CN with the fourth row hovered, is in the pod thread.

Written by UX Lead, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit bd2f10e Oct 23, 2026
26 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