fix: Don't select shadow blocks on click #9538
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
targetBlockrather thanstartBlock, 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.