Skip to content

fix(session-tags): right-click on another row while the tag picker is open - #9658

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/session-context-menu-after-tag-popover
Sep 10, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/session-context-menu-after-tag-popover

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Open the tag picker on one session (right-click → Tags…). Now right-click a different session row. The Mac / browser context menu appears. The picker stays open. Kiro Crew's own session menu never shows.

Why it matters

Tagging several sessions in a row is a common flow. Today every second right-click lands on the wrong menu. The user has to press Escape, then right-click again. It feels like the app lost the click.

What changed (motivation → approach → change)

The picker draws a full-screen backdrop (fixed inset-0 z-[9999]). The backdrop only listens for onClick. A right-click fires contextmenu. Nothing stopped it, and nothing passed it on. So the row under the pointer never saw it, and the browser showed its own menu.

The backdrop now handles onContextMenu. It calls preventDefault() so the native menu stays hidden. It closes the picker. Then it re-issues the same contextmenu (same point, same modifier keys) to the element under the pointer. elementBeneath() finds that element with document.elementsFromPoint, skipping the backdrop itself. The row's Radix ContextMenuTrigger receives the event and opens that row's menu, fresh.

flowchart LR
  subgraph Before
    A1[right-click row B]:::ctx --> B1[picker backdrop]:::changed --> C1[browser native menu]:::removed
  end
  subgraph After
    A2[right-click row B]:::ctx --> B2[backdrop: preventDefault + close]:::changed --> D2[elementBeneath → row B]:::added --> E2[row B Kiro Crew menu]:::ctx
  end
  classDef added fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:2px
  classDef changed fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:2px
  classDef removed fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-dasharray:4 3
  classDef ctx fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E
  linkStyle 0,1 stroke:#DC2626,stroke-dasharray:4 3
  linkStyle 2,3,4 stroke:#16A34A,stroke-width:2px
Loading

🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged

The backdrop now hands the right-click to the row under it, and the row's own menu opens.

Scope kept small on purpose. Only the backdrop element forwards. A right-click inside the dialog (for example on the "New tag…" input) keeps its native menu. If nothing selectable is under the pointer, the picker just closes. If the platform has no document.elementsFromPoint, the picker just closes.

Tests

website/src/test/SlotTagPopover.test.tsx (vitest, happy-dom):

  • backdrop right-click: native menu suppressed (defaultPrevented), picker unmounts, the row beneath receives one contextmenu at the same clientX/Y with button: 2, and its Radix menu is open.
  • nothing beneath: still suppresses + closes, no menu opens.
  • no elementsFromPoint: does not throw, suppresses + closes.
  • right-click inside the dialog: not prevented, picker stays, row untouched.
  • elementBeneath(): skips the backdrop and its descendants; returns null when only the backdrop is hit or the API is missing.

website/playwright/session-tags-e2e.spec.ts #17b (real Chromium against the ephemeral harness): open picker on row A, page.mouse right-click on row B → picker hidden, defaultPrevented true, row B's menu open; choosing Tags… there and toggling a tag updates B and not A. Proven RED with the production hunk reverted (expect(picker).toBeHidden() failed with Received: visible), GREEN with it.

test/test_playwright_e2e.py: MIN_EXECUTED_SPECS 223 → 224 for the added spec.

Manual verification

Same flow driven in headless Chromium for the screenshots below. Full gate set run locally: website vitest 1947 files / 30,673 tests, tsc -b, eslint (0 warnings), i18n check + render, phantom-classes, jscpd, Electron 1831/0, mypy / isort / flake8 / black, all scripts/check_* gates, cfn-lint, bundle-size.

Screenshots / video

Before the fix there is nothing to show inside the app: the native OS menu appears and the picker does not move. After:

Picker open on Session A:

Tag picker open on Session A

Right-click on Session B — picker gone, B's Kiro Crew menu open at the pointer:

Picker closed and Session B context menu open

Related Issues

Fixes #9657

Pattern harvest

Rule candidate: review-prompt
Pattern: a full-viewport dismiss backdrop that handles onClick but not onContextMenu lets the native menu through and blocks the app's own context menus beneath it.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) — N/A, behaviour matches what the menu already promises
  • No secrets, credentials, or internal references in the diff

@Pearcekieser
Pearcekieser requested review from a team and chenmingwei23 September 9, 2026 07:22
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 9, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: While the session tag picker is open, a right-click on another session row must close the picker and open that row's Kiro Crew context menu instead of the native OS/browser menu.
Not a goal: Changing left-click dismiss semantics, forwarding any other pointer gesture through the backdrop, or altering right-click behaviour inside the picker dialog itself.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — 🟡 CONCERNS

UX-level review of cf920eda8939b5085353ed337ca870efd8899b88 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Reconciliation: the diff adds no new visible element or string — it changes the behavior of one existing control, the picker's dismiss backdrop (aria-label="Close tag picker"), so a right-click now suppresses the native menu, closes the picker, and re-targets the gesture to the row beneath. The two screenshots proving the after-state are added by the PR (binary markers only in the patch, fork head not checked out), so neither I nor a blind reader can see them. The interaction itself is sound: it restores the exact behavior a first-time user already expects (right-click a row → that row's menu), the picker's dismissal matches the existing left-click light-dismiss, tag toggles persist per-click so no work is lost, and lens 13 doesn't apply — the picker is dismissed by the user's own gesture, not transformed.

UX-Verdict: CONCERNS

The fix restores expected right-click behavior with no new vocabulary; the only shortfall is that the after-state screenshots aren't verifiable in this lane.

Evidence gaps

  • The changed backdrop right-click outcome (picker closed, target row's menu open at the pointer) — the PR's added temp-screenshots/session-context-menu-after-tag-popover/*.png exist only as binary markers here; pushing the branch to this repository would let the blind read see them.

[UX-REVIEWED] cf920ed

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed cf920eda8939b5085353ed337ca870efd8899b88 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] cf920ed

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of cf920eda8939b5085353ed337ca870efd8899b88 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

A real, reproducible UX defect fixed at its actual cause (the backdrop swallowing contextmenu), scoped tightly, with red/green-proven real-browser coverage.

Suggestions

  • The forwarded synthetic event relies on Radix's trigger accepting untrusted contextmenu events — the e2e spec is what pins that across Radix upgrades, so keep 17b in place if the picker is ever migrated to a Radix overlay primitive.

[DESIGN-REVIEWED] cf920ed

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of cf920eda8939b5085353ed337ca870efd8899b88 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All evidence gathered. The fix has solid provenance (issue #9657, an e2e test proven red on base), temp-screenshots/ is a documented committed-deliverables convention, the MIN_EXECUTED_SPECS bump is mandated by the pinned comment, and the repo already has a pointerdown-outside dismiss pattern — but the shipped backdrop-forwarding shape preserves the picker's "left-click only dismisses" contract, so it isn't a mislevelled fix. Two findings survive: the elementBeneath export has zero importers outside its own file and its tests, and exactly one sibling invisible scrim (AgentPillBar.tsx:188) carries the same defect the author's own pattern-harvest names.

First-Principles-Verdict: CONCERNS

The author's own pattern-harvest names the general defect, yet one counted sibling scrim (AgentPillBar.tsx:188) ships unfixed, and elementBeneath is exported for nobody.

Not justified as shipped

  • Item 1 — symptom-level (point patch): grepped fixed inset-0 scrims with onClick and no background class: exactly 1 sibling, the invisible click-away scrim at website/src/apps/meetings/components/AgentPillBar.tsx:188, where the same right-click-swallowing misbehavior the description generalizes ("a full-viewport dismiss backdrop that handles onClick but not onContextMenu") stays live.
  • Item 5 — one consumer, generalized: elementBeneath is exported but grep across website/src finds 0 importers outside SlotTagPopover.tsx itself and its test; the export exists only so the test can call it directly.

What this change ships

Inventory (8 items) — 6 justified

Intent: right-clicking another session row while the tag picker is open should close the picker and open that row's menu — a FIX (issue #9657, e2e proven red on base).

  1. Right-click another row: picker closes, that row's Kiro Crew menu opens — symptom-level (1 unfixed sibling scrim)
  2. Right-click on empty space: picker closes, native menu suppressed — justified
  3. Right-click inside the dialog unchanged, native menu kept — justified
  4. Engines without elementsFromPoint: right-click just closes the picker — justified
  5. New exported elementBeneath helper other code may import — one consumer, generalized (export serves only its own test)
  6. E2E spec 17b added, MIN_EXECUTED_SPECS 223→224 — justified
  7. Unit tests pinning the backdrop contract — justified
  8. Two screenshots committed under temp-screenshots/ — rides along (documented committed-deliverables convention; harm-free)

Watch

  • The same invisible-scrim defect stays live at AgentPillBar.tsx:188 (count: 1, pattern: no-background fixed inset-0 dismiss scrims); the description says "scope kept small on purpose" but never names what is left.
    Clears when: the sibling scrim gains the same onContextMenu dismissal, or the author confirms nothing right-clickable sits beneath it.

Subtractions

  • Drop the export on elementBeneath in SlotTagPopover.tsx and the direct describe('elementBeneath') block — 0 importers outside the file; the component-level tests already pin every branch.

[FIRST-PRINCIPLES-REVIEWED] cf920ed

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed cf920eda8939b5085353ed337ca870efd8899b88 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cf920ed

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 9, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/session-context-menu-after-tag-popover branch from d33b2a6 to e93540f Compare September 9, 2026 08:25
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Re-pushed as e93540f (rebased onto current main, still one commit). Only website/playwright/session-tags-e2e.spec.ts changed: spec 17b now right-clicks near the row's left edge and asserts the point is outside the picker dialog. Under the wide sidebar the spec file's primeBrowser sets, the viewport-centred dialog covered the row centre, so the CI click landed on the dialog (where right-click is deliberately inert). Product code is unchanged. Re-verified locally: RED with the production hunk reverted, GREEN with it, and the full spec file (35/35) green against the ephemeral harness.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 9, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/session-context-menu-after-tag-popover branch from e93540f to fce4286 Compare September 9, 2026 11:48
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main c0cf53f (#9682, the fix for #9675 that was reddening shard 4 on every PR). No changes to this PR's diff; still one commit, now fce4286.

… open

The tag picker's full-viewport backdrop swallowed `contextmenu`. The row
under the pointer never saw the gesture, so the OS/Electron menu opened and
the picker stayed put.

The backdrop now prevents the native menu, closes the picker, and re-issues
the same gesture to the element beneath the pointer (document.elementsFromPoint,
skipping the backdrop). A right-click on another session row therefore opens
that row's Kiro Crew context menu, fresh. A right-click inside the dialog is
untouched.

Tests: vitest regressions for forward / no-target / no-API / inside-dialog,
plus a real-Chromium Playwright spec (17b) proven RED without the fix.
@Pearcekieser
Pearcekieser force-pushed the fix/session-context-menu-after-tag-popover branch from fce4286 to cf920ed Compare September 9, 2026 14:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Re-pushed as cf920ed (rebased onto main 2188f02; diff unchanged, one commit). Reason: on fce4286 the PR-body edit right after the push spawned duplicate pull_request runs for Code Review / GPT 5.6 Review / Screenshot Evidence; concurrency cancelled the newer twins and PR Readiness reads the newest run per workflow, so three green lanes counted as blockers. The body was updated before this push so no twin is spawned.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 9, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Evidence gap: after-state screenshots not verifiable in the fork lane — rebutted
    self-added: no

The two after-state screenshots are committed under temp-screenshots/session-context-menu-after-tag-popover/ and embedded in the PR body as commit-SHA-pinned same-origin URLs, exactly as .github/PULL_REQUEST_TEMPLATE.md prescribes; a human reviewer sees them inline. The lane's inability to open binaries from a fork head is a property of the fork pipeline, not a missing deliverable, so no change is warranted.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Watch: sibling invisible scrim at website/src/apps/meetings/components/AgentPillBar.tsx:188 — rebutted (clear condition met)
    self-added: no

The lane's own clear condition is "the author confirms nothing right-clickable sits beneath it". Confirmed: grep -rln 'onContextMenu\|ContextMenuTrigger' website/src/apps/meetings/ returns zero files, so no Kiro Crew context menu can be swallowed under that scrim; a right-click there only yields the browser's menu for plain content, which is the same as with no scrim. The defect this PR fixes needs a Radix ContextMenuTrigger beneath the backdrop, and the session sidebar is the only surface with both. Findings that ask to forward contextmenu through a scrim with no context-menu consumer beneath it are covered by this ruling.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Subtraction: drop the export on elementBeneath and its direct describe block — rebutted (holds, but disproportional)
    self-added: no

The export exists so the one branch happy-dom cannot reach through a rendered component — "skip the backdrop's own descendants in the elementsFromPoint stack" — is pinned by a direct unit test; the component tests stub a flat [backdrop, row] stack and cannot exercise it. Removing an export keyword and a 20-line test changes no shipped behaviour, while the push it requires re-arms the full fork approval + CI + five-lane review round on a PR that is already readiness: passed. Findings that ask to un-export a helper whose only extra consumer is its own unit test are covered by this ruling.

@bolichen97
bolichen97 enabled auto-merge (squash) September 10, 2026 04:40

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maintainer review (agent-assisted, on behalf of @bolichen97), head cf920eda8.

Verified: SlotTagPopover.tsx:73-90 checks e.target === e.currentTarget, prevents default, resolves the element under the pointer via elementBeneath() (skips the backdrop), closes, then dispatches a bubbling contextmenu at the same point — close and re-issue land in the right order and the test drives the exact sequence.

Non-blocking notes:

  • Keyboard-close focus parity: on the forwarded path Escape returns focus to <body> rather than row B, because the focused picker option is removed before Radix captures activeElement.
  • A keyboard-originated contextmenu (Shift+F10 with the backdrop focused) enters this handler with synthesised coordinates; gating on pointerType would exclude it.
  • The unit test asserts clientX/Y/button but not the modifier keys the body claims are forwarded.

@bolichen97
bolichen97 merged commit fbc8517 into kirodotdev:main Sep 10, 2026
69 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 10, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
… open (kirodotdev#9658)

The tag picker's full-viewport backdrop swallowed `contextmenu`. The row
under the pointer never saw the gesture, so the OS/Electron menu opened and
the picker stayed put.

The backdrop now prevents the native menu, closes the picker, and re-issues
the same gesture to the element beneath the pointer (document.elementsFromPoint,
skipping the backdrop). A right-click on another session row therefore opens
that row's Kiro Crew context menu, fresh. A right-click inside the dialog is
untouched.

Tests: vitest regressions for forward / no-target / no-API / inside-dialog,
plus a real-Chromium Playwright spec (17b) proven RED without the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Right-click on another session while the tag picker is open shows the native OS menu

2 participants