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

[NEW RULE] - ARIA required accessible names - aria-required-accessible-name-gp8n89 #2190

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from

Conversation

giacomo-petri
Copy link
Collaborator

New rule:
The aim of this new rule is to guarantee that ARIA roles requiring an accessible name meet the specified requirements.

Closes issue(s): #2119

Need for Call for Review:
This will require a 2 weeks Call for Review


Pull Request Etiquette

When creating PR:

  • Make sure you're requesting to pull a branch (right side) to the develop branch (left side).
  • Make sure you do not remove the "How to Review and Approve" section in your pull request description

After creating PR:

  • Add yourself (and co-authors) as "Assignees" for PR.
  • Add label to indicate if it's a Rule, Definition or Chore.
  • Link the PR to any issue it solves. This will be done automatically by referencing the issue at the top of this comment in the indicated place.
  • Optionally request feedback from anyone in particular by assigning them as "Reviewers".

When merging a PR:

  • Close any issue that the PR resolves. This will happen automatically upon merging if the PR was correctly linked to the issue, e.g. by referencing the issue at the top of this comment.

How to Review And Approve

  • Go to the “Files changed” tab
  • Here you will have the option to leave comments on different lines.
  • Once the review is completed, find the “Review changes” button in the top right, select “Approve” (if you are really confident in the rule) or "Request changes" and click “Submit review”.
  • Make sure to also review the proposed Call for Review period. In case of disagreement, the longer period wins.

@giacomo-petri giacomo-petri added the Rule Use this label for a new rule that does not exist already label May 10, 2024
@giacomo-petri giacomo-petri self-assigned this May 10, 2024
@giacomo-petri giacomo-petri changed the title Create aria-required-accessible-name-gp8n89.md [NEW RULE] - ARIA required accessible names - aria-required-accessible-name-gp8n89 May 10, 2024
Jym77
Jym77 previously requested changes May 23, 2024
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
description: |
This rule checks that WAI-ARIA accessible name is available when required.
accessibility_requirements:
aria12:accessible_name_required:
Copy link
Collaborator

Choose a reason for hiding this comment

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

IIrc, the second part is supposed to be the id of an element in the document so we can link to it (https://github.com/act-rules/act-tools/blob/cc2208ac0df7d53748d977cc7813887cbbf6a0fc/src/act/get-accessibility-requirement.ts and https://github.com/act-rules/act-tools/blob/cc2208ac0df7d53748d977cc7813887cbbf6a0fc/src/rule-transform/rule-content/get-requirements-map.ts), which this is not.
OTOH it doesn't look like there actually is a single place where this is defined 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Jym77, exactly. Each role has its own unique requirements, which is why I've given it a general label... I'm uncertain about the best approach to address this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

🤔 It seems the WAI website currently doesn't show anything for non-WCAG requirements 🙈 (example), where the old site did (example)…

Not sure why it went away, nor what we want to do. @carlosapaduarte do you have an input on that?

_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com>
Jym77
Jym77 previously approved these changes May 30, 2024
_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved
wcag20:1.1.1: # Non-text Content (A)
secondary: This success criterion is **related** to this rule. This is because elements assigned the ARIA role of `img` or `image` necessitate an accessible name according to WCAG standards. Some of the examples that either pass or fail overlap with this success criterion.
wcag20:1.3.1: # Info and Relationships (A)
secondary: This success criterion is **less strict** than this rule. Unlike WCAG, which might not mandate accessible names for certain elements like table elements, this rule requires them. Consequently, some of the failed examples satisfy this success criterion.
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a "related to" requirement as well. The way I read 1.3.1, it only applies if the accessible name should come from a visible label, who's relationship isn't available programmatically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Although I don't entirely agree with the interpretation, since there might be cases where something is visually clear due to the surrounding context or visual presentation of elements (e.g., a top promo banner carousel without an accessible name, but the section still requires one), I understand the rationale behind it being "related to."

Updating the secondary requirement.

_rules/aria-required-accessible-name-gp8n89.md Outdated Show resolved Hide resolved

Although this ARIA rule mandates authors to ensure an [accessible name][] for each [HTML or SVG element][] [included in the accessibility tree][] and possessing a [WAI-ARIA 1.2][wai-aria 1.2] [semantic role][] requiring an [accessible name][], it does not automatically constitute a WCAG accessibility violation.

For instance, consider a `search` landmark comprising a `form` element with a search label, search input, and search submit button. According to ARIA specifications, both the `search` role and the `form` role necessitate an [accessible name][]. However, adhering strictly to this rule may lead to repetitive announcements by assistive technologies like screen readers, overwhelming users. Therefore, while this might technically breach ARIA specs, it does not necessarily translate to a violation of WCAG accessibility standards.
Copy link
Member

Choose a reason for hiding this comment

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

There are some mistakes in this I think. Search doesn't require a name (searchbox does though). And while the form role requires an accessible name, the form element does not have form as its implicit role unless it has an accessible name, in the same way that the img element does not have the img role unless it has a name.

The `div` element with role `heading` has an empty [accessible name][] due to the empty `aria-label` [attribute value][].

```html
<div role="heading" aria-level="1" aria-label="">Terms</div>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this fails the rule. Browsers ignore empty aria-labels as far as I'm aware. The AccName spec say to do so too:

https://w3c.github.io/accname/#comp_label
D. AriaLabel: Otherwise, if the current node has an aria-label attribute whose value is not undefined, not the empty string, nor, when trimmed of whitespace, is not the empty string:

Comment on lines 199 to 206
#### Failed Example 7

The `div` element with role `heading` has an empty [accessible name][] given by its `aria-labelledby` attribute.

```html
<span id="fail-heading"></span>
<div role="heading" aria-level="1" aria-labelledby="fail-heading">ACT Rules</div>
```
Copy link
Member

Choose a reason for hiding this comment

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

I don't really like this example either. This rule is about checking that elements have accessible names. ACT rules aren't bug trackers to ensure tools have a flawless accessible name calculation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure I understand the point.

I agree with the previous point (Failed Example 6), as the AccName specifications indicate that empty aria-labels should be ignored.

However, I consider this a clear failure, since the element with the role of heading lacks an accessible name due to improper handling by the author.

Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
colabottles
colabottles previously approved these changes Jul 22, 2024
Comment on lines 259 to 260


Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@giacomo-petri giacomo-petri dismissed stale reviews from colabottles and Jym77 August 1, 2024 16:32

rule updated, please check again. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rule Use this label for a new rule that does not exist already
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants