-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Updates the behavior of the top toolbar fixed setting #47277
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
Conversation
|
Size Change: +1.39 kB (0%) Total Size: 1.35 MB
ℹ️ View Unchanged
|
|
I think my biggest concern about this change is that you lose access to a bunch of tools if a block is selected. As a workflow, a common pattern for me on long documents is "Edit Block > Document Overview > Select Block > Edit Block"; and that workflow isn't available to me with this model without first removing focus from a block. That's easy to do with a mouse, but less trivial or discoverable from the keyboard. One thing that might help with this would be if there is a way to deselect the block while in the top toolbar edit tools, so that if you've navigated all the way back to the editing tools, you can get back to the top toolbar immediately. Alternately, the edit post header controls could be placed in a popover at the beginning of the toolbar edit tools, so that those controls are collapsed rather than removed. |
|
@joedolson in the final shape of this there is a button next to the block tools on the left (an up arrow) than can be used to go back to document tools, and there is a button on the right (a button with the block icon, a paragraph in the design) to go back to block tools, all while having a block selected. This PR is just not there yet. Do you think the toggle solution proposed by the design is good enough? |
d658902 to
78aebb6
Compare
|
I feel like the toggle to switch between menus should stay in the same position. Effectively, the arrow control to switch to the document tools and the paragraph tool to switch to the block tools are just a single switch that changes between toolbars, and having one of those tools at the start of the toolset and the other at the end feels strange to me. I think it would be more predictable if the switch control was always in the same position. But yes, that would help a lot! |
This comment was marked as outdated.
This comment was marked as outdated.
|
I am not in favor of this change because of context issues. Let me take a moment and paint some thoughts.
Just my thoughts without testing. Right, wrong, not even close? Thanks. |
I think you're right on the money that it's going to be difficult to get this feature right. It isn't the default option though, so one good thing is you shouldn't ever need to enable it. (though I realise it should also work in a good way anyway even when enabled.) One of the main thing that stands out to me is that the tab order is going to be hard to get right. Currently users expect to be able to shift tab from the block to the block toolbar directly without passing through Options, Settings, Publish and Preview buttons. But this change will put those buttons in the way, and that won't be very convenient. It's worth noting that plugins can also add buttons to this area, which means there could be quite a lot of tab stops. |
64099ef to
6c7c8e8
Compare
|
Here is an idea. How about you visually hide the document tools toolbar and then add events to show it when focus passes through it? That way the experience does not change for keyboard users but you still get the appear/disappear functionality. I simply cannot support adding another tab stop to this area. I was also unaware that there was a slot fill in that area. That really could turn messy one day. |
6c7c8e8 to
861590b
Compare
@alexstine I don't grasp how that would work? Does it mean for keyboard navigation both toolbars will be available at the same time? |
|
@draganescu Correct. Then when the toolbar receives focus, it will be shown visually. Completely removing or hiding the first toolbar from the DOM I do not think is a good idea. |
861590b to
06e9f82
Compare
06e9f82 to
4d42882
Compare
This comment was marked as outdated.
This comment was marked as outdated.
35cd696 to
5cb233f
Compare
4050a07 to
3421026
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
Yeah, I am not a fan of the appearing/disappearing DOM elements either but it seems to be the way of the future with React/Vue/other frameworks. Not the largest issue in the world but things would be less complicated if things did not disappear from the DOM. Something a lot of times sighted people and designers take for granted how hard these interactions can be for people without visual indicators. I totally support conditional rendering for dialogs but it is way over used in Gutenberg even outside of this PR. |
|
I have tried but not succeeded in a different approach, yet I still tink it's possible:
Everything else stays the same for mouse users with buttons that can show and hide document and block tools. My challenge was where to place the block toolbar in fixed mode to respect the bullet requirements above. |
- wraps the edit post header in a slot fill provider - implements a temporary behavior that shows document tools when no block is selected - updates the block tools and parent selector to appear properly in the new place
…slot fill provider
- restores fixed toolbar on mobile viewports - adds hover states to toolbar toggles - adds the correct level up icon - moves CSS to the right files Co-authored-by: Joen A. <[email protected]> Co-authored-by: James Koster <[email protected]>
b85ff40 to
0988ac3
Compare
|
Ok, here is the current state: playing around with the DOM position and some heavy focus management, I can achieve the state in the video. toolbar-focus-aria.mp4There still is work to do:
|
|
@draganescu It is working much better. Keep going, you are close. Thanks. |
15a38d0 to
161eb93
Compare
|
TL;DR; there appears to be a way to not break the keyboard interaction at all but it has sent me basically to square one. With the help of @MaggieCabrera and @jeryj I have found a way to reuse the fixed block toolbar and not have to change where it is rendered. Instead, I can simply reposition it on top of the document tools and style it to fit visually there. This has the great advantage that all the keyboard interaction remains the same! No more tricks. However it has some challenges which I am looking into:
As far as the approach in this PR, Alt+F10 is handled by a hook that manages focus when this keyboard shortcut is used. This hook is not specific to block toolbar but to all navigable toolbars. Because this PR puts two navigable toolbars in the same container Alt+F10 always selects the 1st which is document tools. The other thing I still have to see if I can change this in a reasonable way (unlikely). |
|
Closing in favor of #49634 |
What?
Closes #40450
Updates the behavior of the top toolbar fixed setting.
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
N/A
Screenshots or screencast
top-toolbar-parent-selector-focus-show.mp4