-
Notifications
You must be signed in to change notification settings - Fork 7
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: Ensure visual indicating for focus loss. #226
base: main
Are you sure you want to change the base?
fix: Ensure visual indicating for focus loss. #226
Conversation
If the workspace loses focus, any existing block selection or cursor visuals should be hidden to represent that the focus has been lost.
@rachel-fenichel would be nice to get your thoughts on the experience. From what I can currently tell, the passive indicator doesn't seem 100% consistent as to what shows when in the toolbox (or outside keyboard nav focus entirely), so it would be helpful to get clarity on whether the video above is ideal or, if not, what the ideal experience should be. @cpcallen would like your thoughts on the passive indicator as well--I lack the context as to how it's meant to work. It confuses me that we're using the selection indicator for representing 'passive' focus at the moment since it's the same visual representation as active (and thus doesn't really communicate a difference to the user). |
src/navigation.ts
Outdated
@@ -1139,7 +1139,7 @@ export class Navigation { | |||
// Although it seems like this should never happen, the typings are wrong | |||
// in the base Marker class and this can therefore be null. | |||
if (this.markedNode) { | |||
this.passiveFocusIndicator.show(this.markedNode); | |||
// this.passiveFocusIndicator.show(this.markedNode); |
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.
TODO: Get resolution from Rachel and/or Christopher before finalizing this solution and moving PR to review.
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.
I think we want to continue to display a passive focus indicator here. I agree that is is suboptimal that it is not distinguishable from the active focus indicator—but I think the fix to that is to change how it looks, not to not display it at all. @rachel-fenichel ?
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 has been fixed in the latest, PTAL.
I didn't expect us to lose the context of where a block would go when the flyout is opened. Previously there was a mixed approach to this, with the blue marker for next/previous and what looks like the normal cursor outline for other positions. But I think it did an important job. The UI now looks the same in two scenarios: starting from the toolbox & starting from e.g. a next connection on the workspace, but inserting a block with Enter will behave differently. Absent another proposal, I think we see active focus as outline around the area + the cursor/selection rendering, and passive focus as just the latter. |
The passive focus indicator should show when the active focus moves to the flyout/toolbox. Agree that losing it seems like a problem. I'm fine with Matt's proposal that "we see active focus as outline around the area + the cursor/selection rendering, and passive focus as just the latter". I implemented the passive focus indicator (as it currently exists today) and can give the context you asked for. The passive focus indicator is different from the cursor in two ways:
In implementing the current I just added a draft PR #236 that makes the passive focus indicator distinctive on blocks, and makes both block and next connection indicators controllable with CSS. Please don't merge it with the current colours, but adding that code into your workspace may make it easier to see when you have passive focus and when you have active focus. |
… indicate-when-workspace-focus-is-lost
Currently stuck on trying to pull in #236 as it seems that the CSS style cannot always be reliably reset: Screen.recording.2025-03-05.2.29.35.PM.webmEnabling the passive focus indicator does correctly show up with a dashed line, but navigating back to it (i.e. refocusing it) causes the dashed line to stay even with the selection indicator from core. What's confusing is that I've verified that the stroke dasharray has been correctly set to 'none' when selection returns, so I have no idea why it's not updating correctly. |
This was a workable solution found by Rachel with the explanation captured in a new line comment.
Thanks @rachel-fenichel @microbit-matt-hillsdon and @cpcallen. Please take a look at the latest video and follow up if you have any concerns. Rachel: you mentioned in #236 that we should pick a different color. Might you (or anyone else) have any specific suggestions? I suppose we could use the same selection color now that the (current) passive indicator style is dashed, and maybe lower its stroke width slightly so it's thinner than the selection indicator. |
Conflicts: src/line_cursor.ts
Works for me! |
I was initially surprised that switch to passive focus in the workspace when a context menu or field editor is opened. Logically it makes sense, but there's something a bit weird about the feeling that a value block gets "less selected" when you try to interact with it. Not arguing against this, just sharing in case others feel similarly. Deployment that I tested (as of 2463303619a2defa305e39cc11cacd85aa8b96c9). |
Fixes #92
If the workspace loses focus, any existing block selection or cursor visuals should be hidden to represent that the focus has been lost. Instead, the passive indicator should be shown so that the user has context on where they are returning when navigating back to the workspace.
This changes the hide behavior for the line cursor to also clear any block selection that may be present (since the cursor is using selection as a means of visually highlighting blocks today).
There was an issue restoring selection due to the passive focus indicator interfering with block selection (since it was using selection). This was updated to use non-selection CSS to keep the indicator without affecting the selection state. This pulls in the changes from #236.
See video for the new state:
Screen.recording.2025-03-05.3.41.07.PM.webm