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

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

Open
Jym77 opened this issue Sep 21, 2023 · 2 comments
Open

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

Jym77 opened this issue Sep 21, 2023 · 2 comments

Comments

@Jym77
Copy link
Collaborator

Jym77 commented Sep 21, 2023

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 #1612
It looks like we should update a few more rules for that.

@dd8
Copy link
Collaborator

dd8 commented Oct 2, 2023

The lack of a role mapping for input type=password is due to security concerns: w3c/aria#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
Copy link
Collaborator

dd8 commented Nov 1, 2023

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:

  • 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.

dan-tripp-siteimprove added a commit to dan-tripp-siteimprove/alfa that referenced this issue Aug 13, 2024
github-merge-queue bot pushed a commit to Siteimprove/alfa that referenced this issue Sep 17, 2024
* adding failing unit test.

* adding more fialing tests.

* adding type="password" fields to the applicability.  seems to work i.e. make the tests pass.

* adding expecations Outcomes specifically for the input type="password" case.

* - expanded applicability to include many more type="" attribute values.  inspired act-rules/act-rules.github.io#2123 (comment)
- added corresponding unit tests.  they pass.

* changeset.

* changeset.

* Update packages/alfa-rules/src/sia-r8/rule.ts

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* fixing recently-introduced compilation error, I think.

* fixing recently-introduced error in test.

* changing import style as per review advice at #1667 (comment)

* tightening up the types by using the same InputType type that hasInputType uses (instead of string).
as per review comment at #1667 (comment)

* removing unused import.

* Update packages/alfa-rules/test/sia-r8/rule.spec.tsx

Co-authored-by: Jean-Yves Moyen <[email protected]>

* making new experimental rule: sia-er8.
(as per review comment at #1667 (review) )
so this commit effectively reverts sia-r8.

* changeset.

* refactoring as per review comment at #1667 (comment)

* Extract API

* Update .changeset/swift-meals-check.md

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/src/experimental.ts

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/src/sia-er8/rule.ts

Co-authored-by: Jean-Yves Moyen <[email protected]>

* Update packages/alfa-rules/src/sia-er8/rule.ts

Co-authored-by: Jean-Yves Moyen <[email protected]>

* minor fixes - consequent to the review at #1667 (review)

* Extract API

---------

Co-authored-by: Jean-Yves Moyen <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants