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

Update image-button-non-empty-accessible-name-59796f.md #1865

Conversation

giacomo-petri
Copy link
Collaborator

@giacomo-petri giacomo-petri commented Jun 16, 2022

Added:

  • failed example 3
  • updated "Accessibility Support" section

Closes issue: #1861

Need for Call for Review:
This will require a 1 week Call for Review

Note: Sorry if I made mistakes while creating the pull request, this is my first pull request and first time I contribute to a GitHub project.


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.

Added:
* failed example 3
* updated "Accessibility Support" section
@CLAassistant
Copy link

CLAassistant commented Jun 16, 2022

CLA assistant check
All committers have signed the CLA.

@carlosapaduarte carlosapaduarte added Rule Update Use this label for an existing rule that is being updated reviewers wanted labels Jun 16, 2022
Copy link
Member

@carlosapaduarte carlosapaduarte left a comment

Choose a reason for hiding this comment

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

No mistakes when creating the PR! 👍

I just left a request to do the updated accessibility support section without naming any specific browsers.

@@ -56,6 +56,8 @@ Each target element has an [accessible name][] that is neither empty (`""`), nor

There is a known combination of a popular browser and assistive technology that does not by default support `title` as an [accessible name][].

The image button with non-empty `title` attribute but empty `alt` attribute results in a button with empty accessible name on many browsers. On Firefox, instead, the `title` attribute is used as fallback, resulting in a button with `title` attribute value as accessible name.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should try to write this without naming any specific browsers (like we do in the previous sentence).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks Carlos,
updated using a generic known popular browser as above.

Copy link
Member

@carlosapaduarte carlosapaduarte left a comment

Choose a reason for hiding this comment

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

Editorial suggestion

_rules/image-button-non-empty-accessible-name-59796f.md Outdated Show resolved Hide resolved
My mistake; the resulting accessible name of Failed example 3 is empty (except for Firefox), not default "submit query".
Jym77
Jym77 previously requested changes Jun 23, 2022
Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

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

Typos.

_rules/image-button-non-empty-accessible-name-59796f.md Outdated Show resolved Hide resolved
_rules/image-button-non-empty-accessible-name-59796f.md Outdated Show resolved Hide resolved
@WilcoFiers WilcoFiers requested a review from tombrunet June 30, 2022 13:11
@WilcoFiers WilcoFiers dismissed Jym77’s stale review July 5, 2022 11:59

Updated, please review

@WilcoFiers WilcoFiers requested a review from Jym77 July 5, 2022 11:59
@@ -56,6 +56,8 @@ Each target element has an [accessible name][] that is neither empty (`""`), nor

There is a known combination of a popular browser and assistive technology that does not by default support `title` as an [accessible name][].

An image button with non-empty `title` attribute but empty `alt` attribute results in a button with an empty accessible name on many browsers. There is a known popular browser that uses the `title` attribute as fallback even with empty `alt`, resulting in a button with `title` attribute value as accessible name.
Copy link
Contributor

@scottaohara scottaohara Jul 7, 2022

Choose a reason for hiding this comment

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

an image and an image button are different things. they have two different naming algorithms for a reason. why are they being merged into one test?

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 agree with you; we were almost talking about the need of a clearer definition for "usable text string" in accessible name computation rules.

That said, this rule is specific for image button elements (we didn't merge image and image button elements int one single test).

As per Inapplicable Example 4

The img element is not a user interface component, and so is not tested for Success Criterion 4.1.2 Name, Role, Value.

that confirms that images are not part of this rule.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In light of @scottaohara clarification at w3c/html-aam#414 (comment), I think we can rephrase this in the line of

The naming algorithm (+link to relevant HTML AAM part) uses the first non-empty name, but some AU/AT stop at the first existing one, even if empty.

This would make it clear that it is not just some browsers quirks deciding what to do, but an actual bug in some implementation (and would explain why our examples are built following specs and may behave differently on some browsers).


Maybe we can also add a background note in the line of:

Contrarily to images, empty alt does not make image button decorative. Image buttons are button and therefore exposed as interactive elements.

which is one on these things that is obvious once stated but maybe not so obvious before seeing it once…

This image button has a non-empty `title` attribute, but an empty `alt` attribute. This gives the button an empty [accessible name][].

```html
<input type="image" src="/test-assets/shared/search-icon.svg" title="Search" alt="" />
Copy link
Contributor

Choose a reason for hiding this comment

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

firefox says search button
chrome has no name (bug)
safari says submit button

firefox is correct here
chrome is wrong by providing no name
safari skips title but at least provides the fallback text.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In my opinion this might be subjective (and that's probably also why browsers render this example in different ways).

From 4.3.1 input type="image" Accessible Name Computation

4.3.1 input type="image" Accessible Name Computation
1. If the control has an aria-label or an aria-labelledby attribute the accessible name is to be calculated using the algorithm defined in Accessible Name and Description: Computation and API Mappings.
2. Otherwise use alt attribute.
3. Otherwise use title attribute.
4. Otherwise if the previous steps do not yield a usable text string, the accessible name is a localized string of the word "Submit Query".
If none of the above yield a usable text string there is no accessible name.

In our example the alt attribute has been clearly defined as empty (alt=""). Depending on interpretations, we might stop at point 2, considering the alt="" as a choice to make the image decorative, or we can move forward reviewing the title.

Even more important is that for images, the HTML Accessibility API Mapping contemplate (rightly) the specific scenario (4.10 img Element)

4.10.1 img Element Accessible Name Computation
1. If the img element has an aria-label or an aria-labelledby attribute the accessible name is to be calculated using the algorithm defined in Accessible Name and Description: Computation and API Mappings.
2. Otherwise use alt attribute, even if its value is the empty string.
NOTE
An img with an alt attribute whose value is the empty string is mapped to the presentation role. It has no accessible name.
3. Otherwise, if there is no alt attribute use the title attribute.
4. Otherwise there is no accessible name.

Combining these two items, might result unclear which are expectations.

Interesting also the example provided by @Jym77 when images are not loaded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In addition, if these are the expectations, it is necessary that all browsers move in this direction; right now, this example might be an important barrier for some user depending on the technology the user is using.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the light of the recent clarifications, this should be a Passed Example indeed (since the empty alt does not provide a "usable string").
Description can say that the image button has name "Search", but some UA/AT (incorrectly) either use the empty alt or the fallback "Submit query".

Jym77
Jym77 previously requested changes Jul 8, 2022
@@ -56,6 +56,8 @@ Each target element has an [accessible name][] that is neither empty (`""`), nor

There is a known combination of a popular browser and assistive technology that does not by default support `title` as an [accessible name][].

An image button with non-empty `title` attribute but empty `alt` attribute results in a button with an empty accessible name on many browsers. There is a known popular browser that uses the `title` attribute as fallback even with empty `alt`, resulting in a button with `title` attribute value as accessible name.
Copy link
Collaborator

Choose a reason for hiding this comment

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

In light of @scottaohara clarification at w3c/html-aam#414 (comment), I think we can rephrase this in the line of

The naming algorithm (+link to relevant HTML AAM part) uses the first non-empty name, but some AU/AT stop at the first existing one, even if empty.

This would make it clear that it is not just some browsers quirks deciding what to do, but an actual bug in some implementation (and would explain why our examples are built following specs and may behave differently on some browsers).


Maybe we can also add a background note in the line of:

Contrarily to images, empty alt does not make image button decorative. Image buttons are button and therefore exposed as interactive elements.

which is one on these things that is obvious once stated but maybe not so obvious before seeing it once…

This image button has a non-empty `title` attribute, but an empty `alt` attribute. This gives the button an empty [accessible name][].

```html
<input type="image" src="/test-assets/shared/search-icon.svg" title="Search" alt="" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the light of the recent clarifications, this should be a Passed Example indeed (since the empty alt does not provide a "usable string").
Description can say that the image button has name "Search", but some UA/AT (incorrectly) either use the empty alt or the fallback "Submit query".

@giacomo-petri giacomo-petri requested a review from Jym77 July 28, 2022 15:12
@Jym77 Jym77 dismissed their stale review August 4, 2022 07:14

Changes done

Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

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

Polishing a bit the notes.

_rules/image-button-non-empty-accessible-name-59796f.md Outdated Show resolved Hide resolved
_rules/image-button-non-empty-accessible-name-59796f.md Outdated Show resolved Hide resolved
@giacomo-petri giacomo-petri requested a review from Jym77 September 8, 2022 19:46
Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

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

Fixing a typo i my previous suggestion 🙈

_rules/image-button-non-empty-accessible-name-59796f.md Outdated Show resolved Hide resolved
@giacomo-petri giacomo-petri requested a review from Jym77 September 26, 2022 10:22
@giacomo-petri giacomo-petri added the Review Call 1 week Call for review for small changes label Sep 29, 2022
## Background

Contrarily to images, an empty `alt` attribute does not make image button decorative; image buttons have a button role and are therefore exposed as interactive elements. Consequently, an empty `alt` attribute does not provide a "usable string" for image buttons and the computation defaults to other means of providing a name.
Copy link
Member

Choose a reason for hiding this comment

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

  1. I don't think you should use Contrarily to images, you're talking specifically about the img element. There are different types of images in HTML.
  2. I'm not sure what that second sentence means. Can you make it clearer?

Copy link
Collaborator Author

@giacomo-petri giacomo-petri Sep 30, 2022

Choose a reason for hiding this comment

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

  1. I agree with the 1st item. I'll update "images" with img elements.

  1. About the second sentence

Consequently, an empty alt attribute does not provide a "usable string" for image buttons and the computation defaults to other means of providing a name.

it refers to the previous adjacent Accessibility support paragraph

The input type="image" Accessible Name Computation algorithm uses the first non-empty name, but some user agents and assistive technologies combinations stop at the first existing one, even if empty.

Per input type="image" Accessible Name Computation algorithm, if the alt attribute value consists in a non-usable string the title attribute should be considered, and again, if the title attribute value consists in a non-usable string, the accessible name is a localized string of the word "Submit Query".

For the sake of clarity I'll update

Consequently, an empty alt attribute does not provide a "usable string" for image buttons and the computation defaults to other means of providing a name.

in

Consequently, an empty alt attribute does not provide a "usable string" for image buttons and the computation defaults to other means of providing a name, as defined in input type="image" Accessible Name Computation algorithm.

Does it make sense?

@giacomo-petri
Copy link
Collaborator Author

As per our conversation, I've removed Passed example 5 and I've opened an issue about how to handle those cases: #1954

@WilcoFiers WilcoFiers merged commit 8494f81 into act-rules:develop Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review Call 1 week Call for review for small changes reviewers wanted Rule Update Use this label for an existing rule that is being updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants