act-rules / act-rules.github.io

Accessibility conformance testing rules for HTML
https://act-rules.github.io/
Other
137 stars 70 forks source link

Should `<input type="password">` be considered as form field? #2123

Open Jym77 opened 1 year ago

Jym77 commented 1 year ago

As per HTML AAM, <input type="password"> elements have no role.

This means that they are not considered by most of our "form fields" rules, among other Form field has non-empty accessible name, therefore we do not flag <input type="password"> as missing an accessible name, while it seems that it should.

I do remember us already doing some tricks around <input type="password"> in https://github.com/act-rules/act-rules.github.io/pull/1612 It looks like we should update a few more rules for that.

dd8 commented 1 year ago

The lack of a role mapping for input type=password is due to security concerns: https://github.com/w3c/aria/issues/935

Some other input types also have no ARIA role mapping, but map to various platform-specfic API roles (IA2_ROLE_DATE_EDITOR / AXTimeField / ROLE_SYSTEM_SPINBUTTON)

dd8 commented 1 year ago

One way of doing this is looking at the platform-specific roles for controls with no ARIA role mapping. For input type=password this maps to:

So you could use wording like the following:

This rule applies to any element that is included in the accessibility tree, and that has:

The second item only applies for elements with no explicit role and marked as 'No corresponding role' in HTML AAM but have platform specific mappings. This looks like it can be extended to other input types like input type=time as well.