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

RTL paragraph: 'Left to right' toolbar menu missing label and selected state semantics #42314

Closed
afercia opened this issue Jul 11, 2022 · 2 comments · Fixed by #42324
Closed
Assignees
Labels
[Block] Paragraph Affects the Paragraph Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jul 11, 2022

Description

When the admin language is a Right-To-Left language, the Paragraph block toolbar shows an additional dropdown menu to give users the ability to set the text direction to Left-To-Right:

Screenshot 2022-07-11 at 10 04 44

  • The toggle button is unlabelled: there's no text or aria-label to provide the button name.
  • When activated, the 'Left to right' menu item is highlighted only visually. There's no semantics to indicate its selected state. This menu item should have a role="menuitemcheckbox" and an aria-checked="false/true" attribute.

Step-by-step reproduction instructions

  • Set the WordPress to a RTL language.
  • Edit a post and add a Paragraph block.
  • Select the block to make its toolbar appear.
  • Inspect the toggle button that is placed on the left of the 'Align' button and observe it's unlabelled.
  • Click the button to open the dropdown menu.
  • Inspect the 'Left to Right' menu item button: observe there's no aria-checked=false attribute.
  • Click 'Left to Right': the Paragraph text is now set to LTR and the menu closes.
  • Open the menu again.
  • Inspect the 'Left to Right' menu item button: observe there's no aria-checked=true attribute.

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 [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block library /packages/block-library [Block] Paragraph Affects the Paragraph Block labels Jul 11, 2022
@afercia
Copy link
Contributor Author

afercia commented Jul 11, 2022

Fixing the ParagraphRTLControl would be pretty simple:

  • Pass a label prop with meaningful text to ToolbarDropdownMenu.
  • Pass role: 'menuitemcheckbox' to the only control in the controls prop array.

However, I'm not sure a dropdown menu with only one menu item is the best option in the first place. Users are forced to click twice to activate this settings, while a simple button would require just one click.

@afercia
Copy link
Contributor Author

afercia commented Jul 11, 2022

Looks like this control wrapper used to be a ToolbarGroup and changed to DropdownMenu in #29863. Later, it changed to a ToolbarDropdownMenu. That may explain the lack of a label and semantic state, as the ToolbarGroup used to render a toggle button with a label and an aria-pressed state:

Screenshot 2022-07-11 at 11 46 07

@afercia afercia self-assigned this Jul 11, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 11, 2022
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants