Skip to content

editor: a placed item stays selected through the click after its drop - #1054

Merged
Aymericr merged 2 commits into
mainfrom
fix/placed-item-stays-selected
Oct 14, 2026
Merged

Aymericr merged 2 commits into
mainfrom
fix/placed-item-stays-selected

Conversation

@Aymericr

@Aymericr Aymericr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

A catalog item dropped on the ground of a new project is placed but left unselected, so its inspector never opens (hosted E2E preset-capture-transparency and project-snapshot-sky fail on it since the #1024 pin).

Why: a surface :click is synthesized on pointer-up (use-node-events). A placement that commits there (a floor drop whose ray lands on the site mesh, a wall, an item host) still has the browser's own click to come. Since #1024 the editor is back in select mode by the time that click arrives, and useGridEvents → SelectionManager.onGridClick takes it for a click on empty ground and calls handleDeselect. Traced in a local probe: finishCommittedPlacement selects item_… from commitFloorOnSurfaceClick (node:click), then the same press's DOM click deselects it from SelectionManager.onGridClick. Bisected on the hosted pins: editor f88b020e keeps the selection, 18eb6392 (#1024) and every pin since drop it.

The coordinator now eats that click when a non-repeating drop lands between a pointer-up and its click, the way the press-drag release already did (swallowNextClick, hoisted so both paths share it). A drop made by the click itself (grid:click) leaves the next click alone.

How to test

  1. Open a new project, Items → Sofa, click the ground in the 3D view.
  2. Expected: the sofa is placed, selected (outline), and its inspector ("Sofa") opens. Before: placed, unselected, no inspector.
  3. bun test packages/editor/src/components/tools/item/placement-history.test.tsx (from the repo root here): the new "item placement selection" case fails without the coordinator change and passes with it.

Screenshots / screen recording

N/A — the visible result is the inspector opening after a drop; verified through the hosted E2E below.

Checklist

  • I've tested this locally with bun dev (hosted Community dev server on this branch: preset-capture-transparency.spec.ts passes; it failed on the same step before)
  • My code follows the existing code style (run bun check to verify) (biome check on the two files)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Checks run: biome on both files, turbo check-types for @pascal-app/editor, the test file above (12 pass). Not run: the editor repo's full test suite.

🤖 Generated with Claude Code


Note

Low Risk
Targeted input-event handling in the item placement coordinator with a new unit test; no auth, data, or broad selection refactors.

Overview
Fixes newly placed floor items losing selection (and the inspector not opening) when the drop commits on pointer-up via a synthesized surface node:click, while the editor has already switched back to select mode.

The placement coordinator hoists the existing swallowNextClick helper (previously only used for press-drag release) and tracks a releasing window between capture-phase pointerup and the browser’s following click. finishCommittedPlacement now swallows that next DOM click when the commit happened in that window, so it cannot hit the grid as “empty ground” and deselect the item. Commits that are the click itself (grid:click) are unchanged.

Adds a regression test in placement-history.test.tsx that simulates pointer-up placement and asserts selection is kept and the follow-up click is prevented (then allowed again after the swallow timeout).

Reviewed by Cursor Bugbot for commit d960aa4. Bugbot is set up for automated code reviews on this repo. Configure here.

…ows its drop

A surface `:click` is synthesized on pointer-up (use-node-events), so a
placement that commits there (a floor drop whose ray lands on the site, a
wall, an item host) still has the browser's own click to come. Since #1024
the editor is back in select mode by then, and the grid takes that click for
one on empty ground: the new item is placed and immediately deselected, and
its inspector never opens. The coordinator now eats that click when a
non-repeating drop lands between a pointer-up and its click, as the
press-drag release already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Aymericr

Copy link
Copy Markdown
Contributor Author

Hosted pin for CI: pascalorg/private-editor#948 (re-pin to the merge commit once this merges). The sky spec's separate stale step is pascalorg/private-editor#947.

…later click is not eaten

The 300 ms timer that unregisters the swallow fired after the test file ended, where
window is gone, and failed the run between tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Aymericr
Aymericr merged commit 8598404 into main Oct 14, 2026
4 checks passed
@Aymericr
Aymericr deleted the fix/placed-item-stays-selected branch October 14, 2026 13:59
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