Skip to content

Conversation

@BenHenning
Copy link
Collaborator

@BenHenning BenHenning commented May 15, 2025

The basics

The details

Resolves

Fixes part of RaspberryPiFoundation/blockly-keyboard-experimentation#525

Proposed Changes

This introduces an isClickable override for FieldImage that only allows images to be clickable when they have a click handler.

Reason for Changes

Without this change it's possible to navigate to non-clickable images (like the quotes in certain text blocks) since #9054. This is both a confusing experience and causing a test failure in the keyboard navigation plugin: RaspberryPiFoundation/blockly-keyboard-experimentation#527 (comment).

Test Coverage

New tests have been added for FieldImage.isClickable() and have been specifically verified such that that the following new tests correctly fail without the fix in place:

  • For attached, enabled, editable field without click handler returns false
  • For attached, enabled, editable field with removed click handler returns false

The first one perfectly covers the case that caused the regression, so these tests should help ensure the regression doesn't occur again.

Additionally, the tests in RaspberryPiFoundation/blockly-keyboard-experimentation#527 have been verified against this PR via linking and verified to pass.

I've manually tested the scenarios involving quotes (since that was the direct failure case) in the keyboard navigation plugin test environment and placed some similar blocks in core Blockly's simple playground (while checking console logs) to verify nothing obvious is broken.

Documentation

No new documentation changes should be needed.

Additional Information

This is a fix suggested over chat by @gonfunko when helping to investigate why the new test was found failing. Note that this failure is a discrepancy between beta.7 and the full 12.0.0 release.

@BenHenning BenHenning marked this pull request as ready for review May 16, 2025 00:48
@BenHenning BenHenning requested a review from a team as a code owner May 16, 2025 00:48
@BenHenning BenHenning requested a review from RoboErikG May 16, 2025 00:48
@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels May 16, 2025
Copy link
Collaborator Author

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-reviewed changes (quick spot check).

@BenHenning BenHenning changed the title fix: Ensure FieldImage is clickable when appropriate fix: Ensure FieldImage is clickable when appropriate May 16, 2025
@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels May 16, 2025
@rachel-fenichel rachel-fenichel merged commit 3a53af9 into RaspberryPiFoundation:develop May 16, 2025
11 checks passed
@BenHenning BenHenning deleted the fix-field-image-clickability branch May 19, 2025 18:01
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