Skip to content

fix: dont crash after reverting move#9980

Open
maribethb wants to merge 1 commit into
RaspberryPiFoundation:mainfrom
maribethb:fix-revert
Open

fix: dont crash after reverting move#9980
maribethb wants to merge 1 commit into
RaspberryPiFoundation:mainfrom
maribethb:fix-revert

Conversation

@maribethb

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes
With two connected blocks on the workspace, move one to a different connection and commit the move.
Start moving the same block again, but hit escape before committing.
block_svg.ts:313 Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': The new child element contains the parent.
at BlockSvg.setParent (block_svg.ts:313:44)3. Hit escape again
Keyboard shortcut named "commitMove" not found.
(anonymous) @ shortcut_registry.ts:80
dom.ts:119 Uncaught RangeError: Maximum call stack size exceeded
at dom.ts:119:24

Proposed Changes

  • cleans up after a reverted keyboard move
  • removes redundant cleanup code from revertDrag since it's handled in endDrag

Reason for Changes

Test Coverage

added test for this

Documentation

Additional Information

@maribethb maribethb requested a review from a team as a code owner June 11, 2026 20:28
@maribethb maribethb requested a review from mikeharv June 11, 2026 20:28
@github-actions github-actions Bot added the PR: fix Fixes a bug label Jun 11, 2026
@microbit-robert

Copy link
Copy Markdown
Collaborator

This has one negative side-effect. Start a move on a top-level block, then cancel it with Esc. The block gets a fixed yellow (slightly muted?) outline and then you can no longer drag it with the mouse.

You can fix this by using the keyboard to start and confirm another move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants