WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.5k stars 4.19k forks source link

Font Library: Focus loss when disabling buttons on the fly #58314

Closed afercia closed 9 months ago

afercia commented 9 months ago

Description

WIthin the Fonts modal dialog, a few buttons get a HTML disaled attribute on the fly after they are activated. As such, they become not focusable.

While this doesn't impact mouse users, it triggers a focus loss for all keyboard users.

This is the main reason why long time ago we stablished a pattern for such buttons in the editor which follows the pattern suggested in the ARIA Authoring Practices Guidelins:

https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/ Developing a Keyboard Interface Focusability of disabled controls

See also ongoing discussion on https://github.com/WordPress/gutenberg/issues/56547.

Turns out the buttons within the Fonts modal dialog don't follow this best practice. As such, they're one more case in the editor of buttons disabled on the fly that trigger a focus loss. Cc @ciampo

Worth reminding focus losses are a terrible experience for keyboard users and assistive technology users.

In this specific case, the focus loss is even more serious, as focus lands outside of the modal dialog which is something that should never, ever, happen.

The Animated GIF screencapture below illustrates one of these cases. It happens with other buttons as well so they should all be fixed.

focus loss

Step-by-step reproduction instructions

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

ciampo commented 9 months ago

Closing as it looks like the issue was fixed by #58364