Skip to content
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

Block toolbar mover buttons trigger a focus loss #58511

Closed
afercia opened this issue Jan 31, 2024 · 4 comments · Fixed by #58570
Closed

Block toolbar mover buttons trigger a focus loss #58511

afercia opened this issue Jan 31, 2024 · 4 comments · Fixed by #58570
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@afercia
Copy link
Contributor

afercia commented Jan 31, 2024

Description

This appears to be a regression, although I'm not sure when it was introduced.

When using the keyboard to activate the 'Move up' and 'Move down' buttons in the block toolbar, focus is expected to stay on the button that was activated. Instead, there's now a focus loss and focus is moved to the first button within the toolbar.

I haven't dive into the code but I suspect a full-rerendering occurs and the toolbar sets focus on its first focusable control each time.

This unexpected behavior doesn't happen on previous WordPress version, as such it appears to be a regression that should be fixed in the next release. Cc @annezazu

Animated GIF to illustrate:

movers

Step-by-step reproduction instructions

  • Create a post with many blocks.
  • Select a paragraph block.
  • Press Shift + Tab to move focus to the block toolbar.
  • Press the Right arrow key to move focus to the 'Move up' or 'Move down' button.
  • Press Enter.
  • Observe focus is unexpectedly moved to the first button in the toolbar.
  • Expected: focus to stay on the button that was activated.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Regression Related to a regression in the latest release [Package] Block editor /packages/block-editor labels Jan 31, 2024
@annezazu annezazu moved this to 📥 Todo in WordPress 6.5 Editor Tasks Jan 31, 2024
@annezazu
Copy link
Contributor

@jeryj could you perhaps dig in here?

@t-hamano
Copy link
Contributor

t-hamano commented Feb 1, 2024

This issue does not occur in WordPress 6.4.3. Upon further investigation, it appears that this issue first occurred with Gutenberg plugin version 17.3.0.

I think what is shown in the video below is the expected behavior.

151c256fbbc564ac22470f0f120b9af9.mp4

@jeryj
Copy link
Contributor

jeryj commented Feb 1, 2024

Looking at this today!

@jeryj
Copy link
Contributor

jeryj commented Feb 2, 2024

Fix is ready in #58570 along with tests to catch regression. Hopefully this addresses it and doesn't create anything new 😅

@annezazu annezazu moved this from 📥 Todo to 🏗️ In Progress in WordPress 6.5 Editor Tasks Feb 5, 2024
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Done in WordPress 6.5 Editor Tasks Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants