Conversation
…e so we can use shift+tab to focus it. Can't figure out why the toolbarRef isn't working
We're hiding the toolbar via position absolute so it CAN be focused, but just not visible. This allows the alt+f10 shortcut to work and also preserves the initial index without all of the unmounting and remounting stuff.
|
Size Change: -193 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 9819c41. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5427134294
|
|
It's possible that this has been fixed in |
|
Thanks for the update! But I've updated the package and tested it locally, and it doesn't seem to solve this problem 😅 |
|
I noticed this bug in trunk but couldn't figure out where it came from. Once it does mount, tab will place you in it but after a shift+tab to Options button. |
Oh, thanks for testing! That was my best guess since I couldn't really find any other big difference between Reakit and Ariakit that could've impacted this behavior. Just to be sure: did you follow the Updating Existing Dependencies guide to update the package? |
Oh, I had missed this page. I simply tested the following steps:
I assumed it was updated correctly because I saw the following diffs: diff --git a/package-lock.json b/package-lock.json
index f9e56d0a6b..6b2f4d5f33 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -17418,7 +17418,7 @@
"@wordpress/components": {
"version": "file:packages/components",
"requires": {
- "@ariakit/react": "^0.2.10",
+ "@ariakit/react": "^0.2.12",
"@babel/runtime": "^7.16.0",
"@emotion/cache": "^11.7.1",
"@emotion/css": "^11.7.1",
diff --git a/packages/components/package.json b/packages/components/package.json
index 74220c1101..455d3daa3c 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -30,7 +30,7 @@
],
"types": "build-types",
"dependencies": {
- "@ariakit/react": "^0.2.10",
+ "@ariakit/react": "^0.2.12",
"@babel/runtime": "^7.16.0",
"@emotion/cache": "^11.7.1",
"@emotion/css": "^11.7.1",I will test again later according to the documentation procedure. |
|
Hi folks, what's the status of this PR? Is it being actively worked on? Asking because I notice the linked issue is tagged high priority, is in the 6.3 release board, and RC1 is scheduled for next week. Any chance we can get this fixed beforehand? |
|
This isn't actively being worked on, as we're unsure it's even a good idea. It was more of an exploration to see if it was even possible. We can definitely pick it back up, but because it's such a large change in the behavior, it's unlikely to be more stable than reverting to reakit. Before we put more time into this, we should figure out:
The shift + tab behavior in the editor has been debated before. Is this a moment we should use to reconsider the behavior of navigating between toolbars? I know this comment raises a lot more questions than it answers, but I think it'll be useful to figure these out so we can choose the best direction. |
|
@jeryj I would be in favor of dropping Shift+Tab for toolbar since we have Alt+F10. This is a very common shortcut on Windows, F10, so Alt does not make it a very big ask. All the Microsoft Office products use F10 for ribbon navigation. |
|
@alexstine I was looking at that behavior in other editors too. Two questions for implementing that behavior:
|
|
Looks like the regression is fixed by upgrading ariakit to v0.2.12. I'll open a PR. |
That's great! Thanks @diegohaz! I tried this earlier today but it wasn't working for me. It's 100% possible I was doing the upgrade path wrong. I tried:
|
|
Regardless of other considerations, I think this is a great exploration. There does seem to be some advantage to be had. Is there even a tradeoff? I.e. what is gained by removing the toolbar from the DOM? |
|
@stokesman - I agree that having it rendered once but offscreen is a better solution overall, provided it works as expected everywhere. I wasn't sure if it was opening a can of worms of potential bugs though. |
|
@jeryj Answers.
Yes. Although, we'd probably have to change blocks such as navigation to have
Probably so. This practice should have never happened in the first place. It is confusing without vision. If it is going to happen, tabs should be used to section the toolbars. Yet another oversight from lack of accessibility involvement from the start. |
So, ideally, there'd be one toolbar on the page, and using For example, if you're on a caption in an image block you now have three toolbars in different parts of the DOM:
If we were able to position them together in the DOM, one alt+f10 press could bring you to the caption toolbar, then you could use |
|
@jeryj No, I mean actual
The problem becomes communicating to users that there are multiple toolbars in the first place. If you had no vision, what indication is there currently to tell you multiple toolbars exist? None. Shift+Tab and Tab should be restricted to the current block and should not allow you to change context. For example, you should not be able to Shift+Tab from the image toolbar into the top toolbar as the top toolbar is global, you cannot take action on the selected block from there. We always have landmark navigation to reach other regions of the editor. Checkout Microsoft Word for inspiration. I give Microsoft a lot of trash for having some terrible products, Teams being one of them, but the Office suite is solid, works very well and always has. Gutenberg does not work well for screen reader users because there are too many implied visuals. Need to figure out how to change that. Thanks. |
An attempt at fixing #51876. Very much in draft state! I don't even know if this is a good idea, but it was feeling like a good approach since it removed and simplified a lot of the code while also being more performant. I expect to find a lot of bugs with this along the way though :)
Notes:
-There would need to be some kind of deprecation/preserving the old NavigableToolbar initialIndex, onIndexChange, and focusOnMount behavior from before. Or, we could just leave it as is but not use it.
What?
Shift+tab to focus the toolbar stopped working with the upgrade to ariakit. Something changed about the render order where it is rendered too late to receive the focus from shift+tab.
Why?
How?
Instead of trying to get it to render sooner in the process, it seems better to leave it in the DOM and hide/show it via an old-school CSS move-it-way-off-frame method. Doing it this way gives us several advantages:
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast