fix: Fix bug that prevented using keyboard shortcuts when the DropDownDiv is open.#9085
Merged
gonfunko merged 7 commits intoRaspberryPiFoundation:developfrom May 27, 2025
Merged
Conversation
BenHenning
reviewed
May 22, 2025
Collaborator
BenHenning
left a comment
There was a problem hiding this comment.
Thanks @gonfunko! The fix makes a lot of sense, and does seem to improve robustness overall.
Is it possible to test the failure cases for both divs and verify that the fix addresses the issue? I'm not sure how difficult that would be, but this seems like a thing that's very subtle and could potentially break again without some sort of regression check.
1 task
BenHenning
approved these changes
May 27, 2025
Collaborator
BenHenning
left a comment
There was a problem hiding this comment.
Thanks @gonfunko! LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 RaspberryPiFoundation/blockly-keyboard-experimentation#522
Proposed Changes
This PR moves the attachment of the global keyboard shortcut handler to the
DropDownDivandWidgetDivinto those respective modules, rather than adding the listener ininject(). This reduces spooky action at a distance, and fixes a bug caused by a change to theDropDownDivto make it recreate its div between showings in order to guarantee that its state is fully reset. Because the key handler was attached elsewhere, this being unsafe wasn't noticed. Now, the listener is added every time the div is created, and the logic to attach it has been moved into the relevant modules themselves to hopefully avoid being overlooked in a similar manner in the future.