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

Search inputs: avoid unnecessary mismatch between visible label and accessible name #65235

Open
2 tasks done
afercia opened this issue Sep 11, 2024 · 1 comment · May be fixed by #65458
Open
2 tasks done

Search inputs: avoid unnecessary mismatch between visible label and accessible name #65235

afercia opened this issue Sep 11, 2024 · 1 comment · May be fixed by #65458
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Sep 11, 2024

Description

Similar to #65112

See the above issue for more context.

When possible, the visual labeling of controls should match the actual accessible name (provided for example by a visually hidden <label> element, or an aria-label or aria-labelledby attributes).

All the search inputs in the editor should be audited and any mismatch avoided.

As an example, the Search input in the Styles panel > Blocks is visually labeled via its placeholder attribute. This is already arguable, as placeholders should not be used as replacement for labels.

  • The placeholder value is Search.
  • The actual accessible name is Search for blocks.

While the added context may help blind screen reader users, it doesn't help other users and may even be an accessibility barrier, for example for sighted screen reader users and speech recognition / voice control users.

Step-by-step reproduction instructions

  • Go to Site Editor > Styles > Blocks.
  • Observe the search input placeholder is the only visible 'label' of the input and it's Search.
  • Observe the actual accessible name provided by a visually hidden <label> element is Search for blocks.

Screenshots, screen recording, code snippet

Screenshot 2024-09-10 at 14 40 52

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). labels Sep 11, 2024
@afercia
Copy link
Contributor Author

afercia commented Sep 18, 2024

There's plenty of cases of this kind of mismatch. For example, the main Inserter search input:

  • Placeholder: Search.
  • Actual label: Search for blocks and patterns. Notice that it is also inaccurate, as the Inserter now contains blocks, patterns, and media.

Screenshot revealing the visually hidden label:

Screenshot 2024-09-18 at 13 43 15

Same for the link control, etc.:

Screenshot 2024-09-18 at 13 53 18

@afercia afercia self-assigned this Sep 18, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Sep 18, 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). [Status] In Progress Tracking issues with work in progress [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