fix: Don't select shadow blocks on click by gonfunko · Pull Request #9538 · RaspberryPiFoundation/blockly

The basics

The details

Resolves

Fixes #9180

Proposed Changes

This PR fixes a bug that could cause shadow blocks to temporarily or permanently become selected when clicked on. Clicking on a block triggers a block start gesture, which correctly handles shadow blocks when determining what to select (their parent block). Click events bubble up to the workspace and trigger a workspace start gesture as well though, and that was focusing the start block, which is sometimes different than the target block that the block gesture start handler resolves. I updated the check for "nothing else should be focused" to check targetBlock rather than startBlock, and removed the explicit call focus the target/start block, since that would have already happened in the block start gesture handler.

I verified that shadow blocks still become selected via keyboard navigation, that clicking a shadow block focuses its parent block, that workspace comments and bubbles are still selectable, and that clicking the workspace focuses the workspace.