Repository navigation
Conversation
hideIfOwnerIsInWorkspace started its parent walk from the workspace being checked instead of the owner's workspace, so the check always passed and any workspace's hideChaff() closed the WidgetDiv. With the minimap plugin, its zoomToFit() closed the field editor that Tab had just opened. Fixes RaspberryPiFoundation#10429 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| }); | ||
| // jsdom does not implement CSS.escape, which keyboard navigation uses to | ||
| // look up elements by ID. | ||
| global.CSS = { |
There was a problem hiding this comment.
Basically doing a tab on a keyboard, tries to use the querySelector('#' + escaped) to find the next tab-able input. without this, an id starting with numbers or having characters like @ would throw invalid selector error. A bit of overengineering because blockly produces ids.
otherwise even escape: (s) => s would have worked
| let currentWorkspace: WorkspaceSvg | null = workspace; | ||
| let currentWorkspace: WorkspaceSvg | null = ownerWorkspace; | ||
| while (!ownerIsInWorkspace && currentWorkspace) { | ||
| if (currentWorkspace === workspace) { |
There was a problem hiding this comment.
This check was always true first time as the currentWorkspace was workspace only because of the assignment on line 262. Thus an ownership check would always return true
zspriggs
left a comment
There was a problem hiding this comment.
Thanks for tackling this! The changes you've made in widgetdiv.ts look good and the tests in widget_div_test.ts seem reasonable.
However, the behavior you're testing in minimap_tests.mocha.js is pretty well covered by the other tests you've added. Also, although it works generally, the CSS.escape setup may end up being flaky. So for this small change, the core tests are sufficient and you can revert the additions to minimap_tests.mocha.js.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zspriggs - The minimap test changes are reverted now, please re-review. Thank you ! |
zspriggs
left a comment
There was a problem hiding this comment.
Approved, thanks for making those changes.
The basics
The details
Resolves
Fixes #10429
Proposed Changes
Reason for Changes
Blockly uses a single shared WidgetDiv for the whole page, and whichever text editor is open lives inside it.
When you edit a number and press Tab, the value is saved and the editor opens on the next field. If the minimap is on, it replicates the change and calls zoomToFit(), which internally calls hideChaff() to close any open popups.
hideChaff() is supposed to close the WidgetDiv only if it belongs to that workspace (via WidgetDiv.hideIfOwnerIsInWorkspace), but that ownership check is broken and always passes. So the minimap closes the editor that just opened on the main workspace.
Test Coverage
Before
After
Screen recording
Before
On branch master
20261027001607.mp4
After
On this MR
20261027001113.mp4
Documentation
None
Additional Information
AI helped in finding the root cause, fixing and testing the app.
The minimap test is based on RaspberryPiFoundation/blockly-samples#2768.
🤖 Generated with Claude Code