Skip to content

fix(admin): remove a grid chip via its × instead of leaving edit mode#637

Merged
CybotTM merged 1 commit into
mainfrom
fix/chipselect-chip-remove
Jul 16, 2026
Merged

fix(admin): remove a grid chip via its × instead of leaving edit mode#637
CybotTM merged 1 commit into
mainfrom
fix/chipselect-chip-remove

Conversation

@CybotTM

@CybotTM CybotTM commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the admin grid's chip cell editor (ChipSelect): clicking a chip's × left edit mode instead of removing the chip (reported on /ui/admin/customers).

Cause

Ark's combobox InteractOutsideEvent is a CustomEvent whose actually-clicked element is in event.detail.target, not event.target (the dispatch node — e.g. the document). The handler read event.target, so a chip's × — which sits in the cell but outside the combobox control, the only in-cell click that reaches onInteractOutside — read as "outside the cell" and committed it, leaving edit mode. The × button's own onClick (remove + refocus) never got to matter because the cell had already closed.

Fix

Read event.detail.target (falling back to event.target where detail is absent).

Verification

  • bun run typecheck / lint clean; chipSelect unit tests (13) pass.
  • New e2e test in admin-inline-edit.spec.ts: after clicking a chip's ×, the chip is gone and the cell is still being edited.
  • Caveat: the failure only manifests in a real browser — jsdom doesn't fire Ark's interact-outside, and the Playwright runner doesn't reproduce it either (the same environment gap seen elsewhere). So the e2e test guards the × behaviour generally; the fix itself rests on the documented Zag event shape (detail.target = the click target).

Ark's combobox InteractOutsideEvent is a CustomEvent whose actually-clicked
element is in event.detail.target, not event.target (the dispatch node). The
ChipSelect read event.target, so in a real browser a chip's × — which sits in the
cell but outside the combobox control, the only in-cell click that reaches
interact-outside — read as "outside" and committed the cell, leaving edit mode
instead of removing the chip. Read event.detail.target, falling back to
event.target where detail is absent.

The failure only manifests in a real browser (jsdom doesn't fire interact-outside;
the Playwright runner doesn't reproduce it either), so the added e2e test guards
the × behaviour generally rather than as a strict regression guard for this event
bug.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Copilot AI review requested due to automatic review settings July 16, 2026 06:55
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM merged commit f2f4e85 into main Jul 16, 2026
17 of 18 checks passed
@CybotTM
CybotTM deleted the fix/chipselect-chip-remove branch July 16, 2026 07:58
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.

2 participants