-
Notifications
You must be signed in to change notification settings - Fork 13
fix: remove marked node field #273
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: remove marked node field #273
Conversation
Instead hide/show cursor/passive focus indicator on the relevant focus changes. Fixes RaspberryPiFoundation#263
|
Note to self: if we merge this then the same logic needs to be run in the external toolbox scenario. |
cpcallen
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.
Code looks fine (though note comments below). Would like to verify that this works in practice before merging, though, as @rachel-fenichel had some concerns.
| const cursor = workspace.getCursor(); | ||
| if (cursor) { | ||
| this.passiveFocusIndicator.show(cursor.getCurNode()); | ||
| cursor.hide(); |
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.
It should be noted that (contrary to expectations) Marker.prototype.hide does not cause the cursor to be persistently hidden, but only hides the marker SVG, and only until the next time a render occurs.
Marker SVG is used for denoting position of cursor when it is on a connection or on the workspace (or on a whole-stack node, though these are only currently accessible via the context-out shortcut which will probably go away very soon).
So AFAICT this won't hide the cursor if it's on a block, and if it isn't on a block then it will be hidden but may reappear unexpectedly if something causes a render to occur.
Probably not a big deal, given that the existing code does exactly the same thing, though I do wonder if it might be better to hide the cursor before showing the passive focus indicator (here and in focusFlyout).
| this.passiveFocusIndicator.show(cursor.getCurNode()); | ||
| cursor.hide(); |
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.
Does it still work if you call cursor.hide() before passiveFocusIndicator.show? It would seem more tidy to do it in that order.
|
OK, I played with this for a while and couldn't find any situations in which the cursor was not in the expected place. LGTM. |
|
Closing in favour of discussion around #326 |
Instead hide/show cursor/passive focus indicator on the relevant focus changes.
Fixes #263
I totally might be missing a reason why we can't do this. But if we can it seems like a clear win.
Demo: https://simplify-marked-node.blockly-keyboard-experimentation.pages.dev/