-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix: don't visit connections with the cursor. #9030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't visit connections with the cursor. #9030
Conversation
rachel-fenichel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks solid to me but I asked @RoboErikG to also take a look
RoboErikG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good and I think it can be submitted after rebasing and doing one more sanity check since I don't think you can test this in the toolbox without the recent fixes to toolboxes (I tested with a rebase, but please double check).
I also found a few issues not directly related to this change that I'll file bugs for:
- You can't add disabled blocks to the workspace from the toolbox (so break can't be added)
- I think if you could add a break getPreviousSibling wouldn't return it
- Empty inputs can't be navigated to which feels wrong, especially with the list blocks, but was mentioned in another thread for discussion
| // If navigating to a previous stack, our previous sibling is the last | ||
| // block in it. | ||
| if (navigatingCrossStacks && result instanceof BlockSvg) { | ||
| return result.lastConnectionInStack(false)?.getSourceBlock() ?? result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I didn't have time to investigate, but I suspect this will return the first block in a stack if you have a termination block (blocks without a next connection) on the end of the stack. This is rare enough that it probably makes sense to fix in a follow-up issue since you'll likely need to add a method to get the last block in a stack instead of the last connection.
|
One issue I realized this created is resolved by RaspberryPiFoundation/blockly-keyboard-experimentation#516; PTAL at that as well. |
The basics
The details
Resolves
Fixes RaspberryPiFoundation/blockly-keyboard-experimentation#464
Proposed Changes
This PR updates the navigation policies to not visit connections, but instead proceed directly to the connected block/field. The connection navigation policy has been left in place for now, but is mostly unreachable (outside of a connection being selected in some cases when a block is deleted). This also makes siblings/parents/children semantically accurate for blocks, fields and the workspace, and allows simplifying the
LineCursor.