Skip to content

Fix id attribute to match aria-owns attribute - #15564

Merged
gziolo merged 2 commits into
WordPress:masterfrom
gchtr:fix-url-input-aria-owns
May 13, 2019
Merged

gziolo merged 2 commits into
WordPress:masterfrom
gchtr:fix-url-input-aria-owns

Conversation

@gchtr

@gchtr gchtr commented May 10, 2019 •

Copy link
Copy Markdown
Contributor

Description

In #14420, class names were changed from editor to block-editor. In that pull request,

aria-owns={ `editor-url-input-suggestions-${ instanceId }` }

has been changed to

aria-owns={ `block-editor-url-input-suggestions-${ instanceId }` }

But the matching id attribute wasn’t changed. This pull request fixes that.

How has this been tested?

I ran tests with npm run test-unit and npm run test-e2e. I also tested by checking the attributes in the browser console.

I didn’t test this with any screen reader software. Maybe someone from the accessibility team wants to look at this.

Types of changes

Accessibility bug fix (non-breaking change which fixes an issue).

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

<div
className="editor-url-input__suggestions block-editor-url-input__suggestions"
id={ `editor-url-input-suggestions-${ instanceId }` }
id={ `block-editor-url-input-suggestions-${ instanceId }` }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract this id to a variable and use it in both places to prevent the same issue to happen again in the future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes total sense! I extracted the id into a variable suggestionsListboxId. 👍

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks for opening this PR. Would you mind addressing my comment before we land this patch: https://github.com/WordPress/gutenberg/pull/15564/files#r282946122?

@gziolo gziolo added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended labels May 10, 2019
@gchtr

gchtr commented May 12, 2019

Copy link
Copy Markdown
Contributor Author

When I extracted the id attribute for the listbox into a variable, I saw that there’s another id for aria-activedescendant that can be extracted into an id. I used the variable names suggestionsListboxId and suggestionOptionIdPrefix. Tell me if they don’t make sense or if there’s a better name we could use!

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gchtr thanks for the follow-up. It totally makes sense to cover both 👍

Nice one. Congrats on your first soon to be landed contribution :)

@gziolo gziolo added the [Package] Block editor /packages/block-editor label May 13, 2019
@gziolo
gziolo merged commit ee7c19a into WordPress:master May 13, 2019
@youknowriad youknowriad added this to the 5.7 (Gutenberg) milestone May 13, 2019
@gchtr
gchtr deleted the fix-url-input-aria-owns branch May 14, 2019 06:55
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

Development

Successfully merging this pull request may close these issues.

3 participants