Skip to content

Keyboard disconnect ('X') can unplug shadows leading to errors #9963

Description

@microbit-matt-hillsdon

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

Keyboard disconnect ('X') can unplug shadows which is a superpower otherwise unavailable that leads to odd behaviours.

Delete on a shadow beeps, cut beeps, M acts on the parent.

But X lets you reach a weird state. The unplugged block is still a shadow so can't be deleted and drag throws errors (likely shadow with no parent).

Reproduction steps

  1. In playground drag out a 1+1 block
  2. Keyboard navigate to a number block shadow within it
  3. Note delete and cut beep
  4. Try X to disconnect, works leaving a hole
  5. Interact with the unplugged shadow: can't delete, drag throws, likely others

Trace below is from the mouse drag attempt.

Priority

Easy guard I think, I've opened #9964.

For prioritisation, I've already opened a separate PR that adds the guard in MakeCode as we already need to wrap the X shortcut for other reasons. But I think this one is pretty bad when it does happen so maybe worth it for others and the fix seems simple/safe.

Stack trace

Uncaught TypeError: can't access property "isShadow", block is null
    setTargetBlock gesture.ts:1001
    setTargetBlock gesture.ts:1004
    setStartBlock gesture.ts:988
    handleBlockStart gesture.ts:781
    onMouseDown block_svg.ts:625
    wrapFunc browser_events.ts:71
    conditionalBind browser_events.ts:86
    initSvg block_svg.ts:243
    initBlock blocks.ts:748
    appendPrivate blocks.ts:463
    appendInternal blocks.ts:397
    createShadowBlock connection.ts:658
    respawnShadow_ connection.ts:348
    respawnShadow_ rendered_connection.ts:572
    setShadowStateInternal connection.ts:620
    setShadowState connection.ts:472
    loadConnection blocks.ts:723
    loadInputBlocks blocks.ts:690
    appendPrivate blocks.ts:461
    appendInternal blocks.ts:397
    getTargetBlock block_drag_strategy.ts:237
    startDrag block_drag_strategy.ts:313
    startDrag block_svg.ts:1823
    onDragStart dragger.ts:34
    updateIsDragging gesture.ts:310
    updateFromEvent gesture.ts:226
    handleMove gesture.ts:466
    wrapFunc browser_events.ts:73
    conditionalBind browser_events.ts:86
    bindMouseEvents gesture.ts:406
    doStart gesture.ts:382
    handleWsStart gesture.ts:735
    handleFlyoutStart gesture.ts:764
    addBlockListeners block_flyout_inflater.ts:231
    wrapFunc browser_events.ts:71
    conditionalBind browser_events.ts:86
    addBlockListeners block_flyout_inflater.ts:223
    load block_flyout_inflater.ts:84
    createFlyoutInfo flyout_base.ts:731
    show flyout_base.ts:625
    updateFlyout_ toolbox.ts:933
    setSelectedItem toolbox.ts:830
    onClick_ toolbox.ts:301
    wrapFunc browser_events.ts:71

Screenshots

Image

Browsers

No response

Metadata

Metadata

Labels

status: triageIssues awaiting triage by a Blockly team member

Type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions