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

Transform to pattern menu sets ARIA roles and attributes on the wrong element #50549

Closed
afercia opened this issue May 11, 2023 · 0 comments · Fixed by #50577
Closed

Transform to pattern menu sets ARIA roles and attributes on the wrong element #50549

afercia opened this issue May 11, 2023 · 0 comments · Fixed by #50577
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented May 11, 2023

Description

Wheb a block can be transformed to a pattern, the transform menu shows a 'Pattern' item as first item. Clicking it, shows the pattern preview. Clicking the pattern preview transforms the block.

trunk

There are a few a11y issues here:

  • The aria-label and aria-describedbby attribute are set on the wrong element. They should be set on the element with role=option. Instead, they're set on its parent element.
  • The focus style of the focusable preview is cut-off on the left and right sides.

Turns out this patterns list BlockPatternsList and pattern item BlockPattern use ad-hoc code instead of the general components already in use in the main inserter. Instead of repeating code, the transform menu should use the general components, which also use correct ARIA.

Step-by-step reproduction instructions

  • Use Twenty Twenty Three.
  • Edit a post, add a Heading block.
  • Open the transform menu from the block toolbar.
  • Click 'Patterns'.
  • You should see one available pattern. To my understanding, this pattern comes from the Patterns directory.
  • If you use Twenty Twenty One instead, you should see two available patterns, as the theme provides one pattern for the heading block.
  • Inspect the source in your browser dev tools.
  • Observe the element with role=option doesn't have the aria-label and aria-describedby attributes.
  • Observe these attributes are set on the option parent.
  • Use the keyboard and observe the pattern item focus style is cut-off on the left and right sides.

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). [Package] Block editor /packages/block-editor labels May 11, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 12, 2023
@afercia afercia added [Type] Bug An existing feature does not function as intended and removed [Status] In Progress Tracking issues with work in progress labels May 12, 2023
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 [Type] Bug An existing feature does not function as intended
Projects
None yet
1 participant