Conversation
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
Proposed Changes
This PR backports the core support for keyboard navigation of the workspace, toolbox and flyout from the blockly-keyboard-experimentation repo. It also refactors things to provide a more cohesive API for interacting with navigation. The general aspirational approach is:
*_navigation_policy.tsfiles specify, for each kind of focusable/navigable entity in Blockly, what its parent, first child, and previous/next siblings are, from a "just the facts"/AST perspective.Navigatorprovides methods to query the "just the facts" relationships between elements, but also provides methods that incorporate business logic to make navigation order in response to the arrow keys make sense/feel right/pass the vibe test.FlyoutNavigatorandToolboxNavigatorcustomize the business logic for navigation in a flyout and toolbox context, respectively, and operate on a set of navigation policies relevant to focusable/navigable entities that exist in those contextsIFocusableTreeprovides aNavigatorinstance which should be used to handle navigation within that treeNavigatorfor the active focus treeThis means that keyboard navigation does not have to keep track of the current state/context as in the keyboard-experimentation repo, because that maps precisely to the currently focused tree, which the
FocusManageralready keeps track of.I backported the navigation business logic from the add-screen-reader-support-experimental branch, where up/down move between "rows" and left/right navigate within the current "row".
Future Work
Breaking Changes
MarkerManager,Marker, andLineCursorhave all been removed, along with their accessors. If you were interacting with one of these classes,Navigatorshould be close to a drop-in replacement.IFocusableTreemust implementgetNavigator(), which should return aNavigatorinstance or subclass appropriate for navigating the treeFlyoutno longer implementsIFocusableNodeorIFocusableTree. The flyout's workspace continues to implement those interfaces, and should be used in place of the flyout itself.IToolboxprovides agetToolboxItems()method that returns an array of all itemsIToolboxItemprovides agetParentToolbox()method that returns a reference to its containing toolbox