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

Need tests for non-empty white space only alt values, and interior white space values #112

Open
cookiecrook opened this issue Mar 23, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@cookiecrook
Copy link
Collaborator

cookiecrook commented Mar 23, 2024

We have some image alt tests in this file:
https://github.com/web-platform-tests/wpt/blob/master/accname/name/comp_host_language_label.html

But I don’t recall testing the logic for generic/none role due to empty alt text (it may be in HTML-AAM) and I’m fairly certain we don’t have tests for non-empty white space variants like alt=" " and other values like TAB, CRLF, etc, which come out of CMS templates sometimes.

Also interior non-space white space should be normalized too.

<img src="" alt="foo
bar" data-expectedlabel="foo bar">
@cookiecrook cookiecrook changed the title Need tests for non-empty white space alt values Need tests for non-empty white space only alt values, and interior white space values Mar 23, 2024
@zcorpan
Copy link
Member

zcorpan commented Mar 26, 2024

A space should be different from the empty string, right?

@cookiecrook
Copy link
Collaborator Author

Correct, though there may be a sufficient requirement in the spec to trim a non-empty whitespace string down to the same equivalent empty string. In any case, I'd expect whitespace-only alt text to be an author error. Proposed tests are primarily to ensure all engines are doing the same thing with the author error.

@cookiecrook cookiecrook added the good first issue Good for newcomers label Apr 2, 2024
@cookiecrook
Copy link
Collaborator Author

For img alt, HTML differentiates the empty string from any other value -- only the empty string is special.
https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element%3Athe-img-element-11

Originally posted by @zcorpan in #115 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants