-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Support Navigation and Edit Mode #16500
Conversation
Hoooly guacamole, it's happening! Here's a quick GIF: Initial keyboard usage impressions feel great. Fast, fluid, and it feels kind of intuitive too. Would it be possible to allow the Delete button to delete the focused block? I would love to be able to, in any block, press Escape and then Delete to delete that block. The focus style should probably also be rather different from both the hover and selected states. It seems like such a focus has more in common with either a multiselected block, or a focused textfield: |
This is very cool! In my tests, it only appears to work if you start navigating only with the keyboard. Is that right? Or is there another way to activate it? Once I hit enter to edit a block, I can't figure out how to get back into navigation mode. 🤔
+1 to this. That would be awesome.
I wonder if something like this is more appropriate? It's the same left border we use, but with a blue "active" state. I've also adjusted treatment of the breadcrumb so that it appears like a standard toolbar button. |
you can hit "Escape" when you're in edit mode to enable "navigation" mode. |
This is done. I also added the |
Great! I'll jump in and take a look later today. |
How will it be clear what mode you're in? Modes are generally pretty confusing.
|
What if you can also use Regarding |
In a lot of situations |
Noting that the "Escape" key now conflicts with the previous expected behavior (show the toolbar). I think the new behavior is better but I thought I'd mention cc @aduth (It's breaking some e2e tests now) |
I wonder if we should just show the same blue all around? This is a focus state, so I feel like it should ambiguate more from the selected state than otherwise. Here are some other applications that use what can best be described as a navigation mode. MacOS Finder: It even has the same enter/escape behavior. Slack: Worth noting that in slack, you just use the arrowkeys to navigate, and tab to enter buttons of each message, so it isn't a 1:1 comparison. But the visual style distinctly feels "focusy". |
736415f
to
465a2a9
Compare
Can I have thoughts or a ✅ here? |
I'll review it again in just a bit. |
Thanks everyone for working on this, definitely better than version 1 🙂 I'd like this to be extensively tested by the accessibility team. Given the importance of this new interaction flow, I'd like to not be the only person giving accessibility feedback. Will propose during tomorrow's weekly accessibility meeting. Of course, everyone is welcome to attend the meeting (Note: meetings happen on the WordPress Slack, registration is required). |
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.
Left some minor comments that could be nice to address, but other than that this looks great.
I can't give much accessibility feedback though.
// not already handled by descendant. | ||
onInsertDefaultBlockAfter(); | ||
event.preventDefault(); | ||
if ( canUseShortcuts && isEditMode ) { |
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.
Minor: these nested switch/if statements look a bit odd to me. Could they maybe be combined?
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.
No easy way to do it. We could just use if elses?
} | ||
|
||
componentDidMount() { | ||
window.addEventListener( 'mousedown', this.switchToEditMode ); |
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.
Why does it apply to the whole window? If you click inside a block it makes sense to switch to edit mode. If you click outside a block it makes more sense to stay in navigation mode?
Just tested this (Mac/Firefox 68.0.1) and works like a charm. This is a big improvement IMHO. 🤔 Thought: when in navigation mode, what if we added the ability to move to the sidebar with the right arrow? and then maybe back to the block with the left arrow? |
Interesting idea. It would be good to find ways to improve the navigation to that panel. Right arrow to go there seems ok but left arrow to go back might cause issues depending what "control" is focused on the right sidebar. Imagine it's an input for instance. |
Worth noting right and left arrow keys wouldn't work with screen readers. Also, when the block is in edit mode and the caret is within an editable field, arrow keys should keep their default behavior (moving through text). |
Ok let's try this, happy to address extra feedback. |
closes #11581
This is #5709 take 2
The idea is:
The original PR was abandoned because the keyboard event to enter navigation mode was not caught properly in all screen readers. This is fixed in this PR by using a focused button (the block name/breadcrumb) when in navigation mode.
The breadcrumb still needs to be designed properly (because it's now a button) but the idea is here.
I also removed the breadcrumb "animation" when you hover a block because the button was not showing right after you hit "escape".