act-rules.github.io icon indicating copy to clipboard operation
act-rules.github.io copied to clipboard

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

Open Jym77 opened this issue 2 years ago • 2 comments

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.

Jym77 avatar Sep 21 '23 10:09 Jym77

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)

  • input type=color
  • input type=date
  • input type=datetime-local
  • input type=file
  • input type=month
  • input type=time
  • input type=week

dd8 avatar Oct 02 '23 21:10 dd8

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:

  • ROLE_SYSTEM_TEXT The object represents selectable text that allows edits or is designated as read-only. https://learn.microsoft.com/en-us/windows/win32/winauto/object-roles
  • ATK_ROLE_PASSWORD_TEXT A text object uses for passwords, or other places where the text content is not shown visibly to the user. https://docs.gtk.org/atk/enum.Role.html
  • AXSecureTextField

So you could use wording like the following:

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

  • one of the following semantic roles: checkbox, combobox (select elements), listbox, menuitemcheckbox, menuitemradio, radio, searchbox, slider, spinbutton, switch, textbox.
  • or, has no semantic role but maps to any one of the following platform roles: ROLE_SYSTEM_TEXT, ATK_ROLE_PASSWORD_TEXT, AXSecureTextField in HTML AAM

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.

dd8 avatar Nov 01 '23 12:11 dd8