fix: Limit `LineCursor` & focus syncing by BenHenning · Pull Request #9062 · RaspberryPiFoundation/blockly

The basics

The details

Resolves

Fixes RaspberryPiFoundation/blockly-keyboard-experimentation#526

Proposed Changes

This limits synchronizing in LineCursor from FocusManager to just nodes that have a corresponding block.

Reason for Changes

Limiting the synchronizing in this way ensures that navigation can't enter a bad state. The reason for why this is needed is explained in RaspberryPiFoundation/blockly-keyboard-experimentation#526 (comment).

Longer term it would maybe be ideal to do one or both of the following:

  • Figure out ways of making navigation a bit more robust (perhaps on the keyboard navigation side) such that if cursor is in a bad state there's some way to recover (rather than ending up permanently broken).
  • Remove Marker's internal state in favor of always relying on FocusManager's state to cover the cases where there can be automatic focus shifting.

Test Coverage

This was manually tested with the keyboard navigation plugin and verified to ensure that both RaspberryPiFoundation/blockly-keyboard-experimentation#526 and RaspberryPiFoundation/blockly-keyboard-experimentation#499 are (still) working as expected. Some basic testing was done with the core simple playground with the developer console open to ensure there weren't any expected failures.

Automated testing cases would be better addressed as part of resolving #8915.

Documentation

No new documentation is needed here.

Additional Information

This behavior is expected to only affect the keyboard navigation plugin.