GoogleChrome / accessibility-developer-tools

This is a library of accessibility-related testing and utility code.
Apache License 2.0
2.27k stars 359 forks source link

AX_ARIA_04 #332

Closed sKopheK closed 7 years ago

sKopheK commented 7 years ago

Hello, got this warning about invalid ARIA attributes in my markup. What is exactly wrong in this code, e.g.:

<input autocomplete="false" class="k-password k-input" data-val="true" data-val-regex="Password must be between 6 and 255 characters" data-val-regex-pattern=".{6,255}" data-val-required="'Choose password' should not be empty." id="Password" name="Password" type="password" data-role="password" role="password" aria-valuenow="" aria-disabled="false" aria-readonly="false">

?

ricksbrown commented 7 years ago

I haven't run the tool over it but at a glance:

  1. The role attribute is part of ARIA and the values it can take are limited. There is (currently) no such role as password.

  2. Even if password did exist you'd still likely get a warning because the native semantics are unambiguous. In other words <input type="password" is quite enough to say "this is a password field", the role="password" would be redundant. Read ARIA adds nothing to default semantics of most HTML elements and note:

In the majority of cases setting an ARIA role and/or aria-* attribute that matches the default implicit ARIA semantics is unnecessary and not recommended as these properties are already set by the browser.

  1. aria-valuenow is only used in the roles: progressbar, scrollbar, slider, spinbutton
sKopheK commented 7 years ago

Thanks for the reply, Rick, I'll use the advices to improve my code.