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

Fix id attribute to match aria-owns attribute #15564

Merged
merged 2 commits into from
May 13, 2019

Conversation

gchtr
Copy link
Contributor

@gchtr gchtr commented May 10, 2019

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.

@@ -253,7 +253,7 @@ class URLInput extends Component {
<Popover position="bottom" noArrow focusOnMount={ false }>
<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
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
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. 👍

Copy link
Member

@gziolo gziolo left a comment

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
Copy link
Contributor Author

gchtr commented May 12, 2019

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!

Copy link
Member

@gziolo gziolo left a comment

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