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

The new "copy block" action triggers a focus loss #23994

Closed
afercia opened this issue Jul 16, 2020 · 1 comment · Fixed by #24022
Closed

The new "copy block" action triggers a focus loss #23994

afercia opened this issue Jul 16, 2020 · 1 comment · Fixed by #24022
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jul 16, 2020

Describe the bug

In WordPress 5.5, the block editor has a new feature to copy the block content. When using a keyboard, activating the "Copy" button triggers a focus loss: focus is lost and the tab sequence starts over from the document root.

Focus losses are one of the worst experiences for keyboard users and assistive technologies users, as any previous context is lost and users are forced to navigate again though great part of the UI to get back to the previous position.

To reproduce

  • in WordPress 5.5 Beta 2
  • edit a post
  • edit a paragraph
  • using the keyboard, navigate to the block toolbar:
    • either by pressing Shift-Tab
    • or by pressing Alt+F10
  • focus is now on the toolbar
  • use the left/right arrow keys to move to the "More options" button in the toolbar
  • press Enter or Spacebar to open the More options menu
  • use the down/up arrow keys to navigate to the "Copy" button
  • activate the "Copy" button either with Enter key or Spacebar key
  • the block content is copied, a "snackbar" notification appears
  • now press the Tab key
  • observe the tab sequence start over from the document root: the first focused element is the skip link

Animated GIF to illustrate the behavior:

copy block

Noting that:

  • the focus loss doesn't happen when using the keyboard shortcuts Cmd (Ctrl) + C
  • doesn't happen when cutting a block with Cmd (Ctrl) + X

Since this is a new feature in WordPress 5.5, I'm setting the priority to "high" as any new released feature should be as accessible as possible (certainly should avoid focus losses).

@afercia afercia added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Jul 16, 2020
@afercia
Copy link
Contributor Author

afercia commented Jul 16, 2020

Additionally: after a successful copy action, there's one more tab stop between the "Copy" button and the "Duplicate" button.

This is because Clipboard.js add its visually hidden textarea within the button. Teh textarea is focusable, so it is a tab stop. It is also announced by screen readers.

Similar issues have surfaced during recent work in core for other Clipboard.js Copy buttons. There are ways to fix it. PR incoming.

Screenshot: textarea within the Copy button:

Screenshot 2020-07-16 at 17 53 28

Screenshot: visually hidden textarea after the "Copy" button announced by screen readers:

Screenshot 2020-07-16 at 17 57 42

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). [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant