Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Conversation

clshortfuse
Copy link
Contributor

@clshortfuse clshortfuse commented Nov 16, 2016

mdIcon was improperly assuming its parent's text content would be announced didn't apply ARIA roles properly

  • Apply img role by default
  • Don't change ARIA if it's already valid
  • Prioritize alt attribute for aria-label
  • Apply aria-hidden attr if parent or parent's parent has ARIA label and is not part of role or tagName whitelist
  • Fallback to icon name as an aria label
  • Apply aria-hidden attr instead of aria-hidden when all checks fail
  • Add spec tests to ensure new functionality
  • Remove improper spec test based on text content

Fixes #9629

@clshortfuse clshortfuse added in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: unit tests This PR needs unit tests to cover the changes being proposed P0: critical Critical issues that must be addressed immediately. g3: reported The issue was reported by an internal or external product team. a11y This issue is related to accessibility labels Nov 16, 2016
@clshortfuse clshortfuse added this to the 1.1.2 milestone Nov 16, 2016
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@googlebot googlebot added cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ labels Nov 16, 2016
@clshortfuse
Copy link
Contributor Author

@ThomasBurleson @nbtorcol I haven't built the unit tests yet since I want ensure this is the proper logic before I do.

@nbtorcol
Copy link

nbtorcol commented Nov 16, 2016 via email

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ and removed cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ labels Nov 16, 2016
@nbtorcol
Copy link

This is better, but it is still not correct. I will try to explain more
what is wrong.

• Apply img role by default -- yes

• Don't change ARIA if it's already valid -- yes

• Prioritize alt attribute for aria-label -- yes

• Apply presentation role if parent or parent's parent has ARIA label –
no, see note 1 below

• Fallback to icon name as an aria label -- yes

• Apply presentation role instead of aria-hidden when all checks fail –
no, see note 2 below

  1.   First and foremost, the original—aria-hidden—was better. If it is
    

    not of significance to screen readers, then just make it go away
    completely; don’t turn it into something else. Second, as I mentioned
    before, this logic is flawed. Yes, the ARIA spec says that you can put
    aria-label/aria-labelledby/aria-describedby on any element, regardless of
    tagName or role, but that is not true for some of the Windows screen
    readers, or more correctly the browsers that provide the information to the
    screen readers. Please consider reading this article:
    http://www.ssbbartgroup.com/blog/how-browsers-interact-with-screen-readers-and-where-aria-fits-in-the-mix/.
    There are several ARIA roles that support these ARIA attributes, but, for
    this situation, the best criteria would be to only use the ARIA roles that
    are controls. I sent example code to this effect, and I do not understand
    why it was not even used as a starting point. If this turns out to be to
    complex, then I would recommend just not trying to do this sort of analysis
    and making sure that aria-hidden works, so that people can hide the icons
    on their own if they think it necessary.

  2.   As above, aria-hidden would be better.
    

@clshortfuse
Copy link
Contributor Author

clshortfuse commented Nov 21, 2016

@nbtorcol I'm sorry I didn't use the code your provided (on the issue page), but that was because it was private link on a Google Drive when I started writing the PR (for future reference, something like pastebin.com would serve better). The use of presentation=role instead of aria-hidden is from research that it is more reliable than aria-hidden (especially with IE and JAWS). After more research, it seems it's better to use both (and even possible tabindex=-1). See: http://john.foliot.ca/aria-hidden/

I believe the reason why we want to use role=presentation is because the spec says:

Skip hidden elements unless the author specifies to use them via an aria-labelledby or aria-describedby being used in the current computation. By default, users of assistive technologies won't receive the hidden information, but an author will be able to explicitly override that and include the hidden text alternative as part of the label string sent to the accessibility API.

Which, to my understanding, means aria-labelledby overrides aria-hidden. This is what brings me to the conclusion it's best to use both.

If I understand correctly, you suggest we should only perform a parent aria check based on a whitelist of tagNames and/or or ARIA. It would reduce the specificity of our upwards search, but I have no problem implementing it.

As for the third point of respecting aria-hidden, I have added a check for the mdIcon itself, but I never checked the parent. I will add this to the code.

Edit: Originally my research of aria-label lead me to examples in the ARIA spec related to how to handle labels and images here: https://www.w3.org/TR/wai-aria/roles#presentation and https://www.w3.org/TR/wai-aria/roles#textalternativecomputation

@nbtorcol
Copy link

nbtorcol commented Nov 28, 2016 via email

@ThomasBurleson
Copy link
Contributor

@clshortfuse - status update plz ?

@clshortfuse
Copy link
Contributor Author

@nbtorcol I've added the changed we've discussed. I removed role=presentation since that from an old version of NVDA that didn't support aria-hidden.

I'm a little confused about the whitelisting type attribute, since as far as I could tell, we'd pretty much be performing HTML validation for valid inputs, since we're are listing every possible type value.

I feel a blacklist would work better, or else our code will eventually become incompatible when newer versions of the HTML spec and when new ARIA roles are created.

@clshortfuse clshortfuse force-pushed the icon-a11ySupportFix branch 2 times, most recently from 3bd88be to 6d2287c Compare December 9, 2016 05:50
@nbtorcol
Copy link

nbtorcol commented Jan 4, 2017 via email

@ThomasBurleson ThomasBurleson modified the milestones: 1.1.3, 1.1.2 Jan 4, 2017
@nbtorcol
Copy link

nbtorcol commented Jan 4, 2017 via email

@clshortfuse
Copy link
Contributor Author

@nbtorcol Yes, I do have access. I'm updating the PR now. Thank you!

@nbtorcol
Copy link

nbtorcol commented Jan 4, 2017 via email

@clshortfuse
Copy link
Contributor Author

@nbtorcol I just want to confirm a couple of concerns

  • ARIA ROLES menu and scrollbar are now being blacklisted, but were whistlisted before
  • INPUT TYPES number and time are now being blacklisted, but were whistlisted before
  • HTML TAGS menu and time are now being blacklisted, but were whitelisted before
  • I couldn't find where to put tu, since it's neither a role, type, or tag.

Perhaps we should

  • return false if aria role blacklist fails
  • return true if any input type is used
  • return false if html tag blacklist fails

Also, I would need some clarification about hwo to use the shared role and tag names.

@nbtorcol
Copy link

nbtorcol commented Jan 4, 2017 via email

@clshortfuse
Copy link
Contributor Author

@nbtorcol @ThomasBurleson All changes have been made and we are ready for review.

@clshortfuse clshortfuse added needs: review This PR is waiting on review from the team and removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs labels Jan 4, 2017
@nbtorcol
Copy link

nbtorcol commented Jan 5, 2017 via email

return false;
}
/* Perform role blacklist check */
if (domElement.attributes.role) {
Copy link
Contributor

@ThomasBurleson ThomasBurleson Jan 5, 2017

Choose a reason for hiding this comment

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

@clshortfuse - Please move this to the aria utils. This complexity should not be in the iconDirective.

@clshortfuse clshortfuse force-pushed the icon-a11ySupportFix branch 4 times, most recently from 4bbf420 to 3e5ef8e Compare January 6, 2017 16:33
@clshortfuse
Copy link
Contributor Author

@nbtorcol Generally, we ask another team member to check our work before we commit directly to our master branch

@ThomasBurleson I made the changes, as requested. Both functions are now accessible by any component via the $mdAria service. Also, the number of parents searches are based on a passed variable.

@ThomasBurleson
Copy link
Contributor

LGTM

@ThomasBurleson ThomasBurleson added needs: presubmit and removed needs: review This PR is waiting on review from the team labels Jan 7, 2017
mdIcon was improperly assuming its parent's text content would be
announced didn't apply ARIA roles properly

icon component:

* Apply `img` role by default
* Don't change ARIA if it's already valid
* Prioritize `alt` attribute for aria-label
* Apply `aria-hidden` attr if parent has ARIA level (2 levels deep)
* Fallback to icon name as an aria label
* Apply `aria-hidden` attr instead of `aria-hidden` when all checks fail
* Add spec tests
* Remove improper spec test based on text content

aria service:

* Add hasAriaLabel func to check for valid aria label
* Add parentHasAriaLabel func to check parents for valid aria with role and tagName blacklists
* Add spec tests

Fixes angular#9629
@ThomasBurleson ThomasBurleson modified the milestones: 1.1.3, 1.1.4 Feb 4, 2017
@mmalerba mmalerba merged commit f0facb2 into angular:master Feb 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ g3: reported The issue was reported by an internal or external product team. P0: critical Critical issues that must be addressed immediately.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants