-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix: img with missing alt should have role img #430
Conversation
- browsers will treat an image with missing alt as an image. - null alt is different than empty string: empty string removes the node from the AOM, where missing (null) alt does not.
🦋 Changeset is good to goLatest commit: 4bc3983 We got this. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -89,6 +89,7 @@ const cases = [ | |||
["html", null, createElementFactory("html", {})], | |||
["iframe", null, createElementFactory("iframe", {})], | |||
["img with alt=\"some text\"", "img", createElementFactory("img", {alt: "text"})], | |||
["img with missing alt", "img", createElementFactory("img", {})], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per discussion #429 (comment) I think we agree on this behavior @eps1lon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to wrap the case in a block statement to avoid misleading block scoping:
case "img": { /* your code */ }
@@ -89,6 +89,7 @@ const cases = [ | |||
["html", null, createElementFactory("html", {})], | |||
["iframe", null, createElementFactory("iframe", {})], | |||
["img with alt=\"some text\"", "img", createElementFactory("img", {alt: "text"})], | |||
["img with missing alt", "img", createElementFactory("img", {})], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
@ckundo Much appreciated, thanks! |
alt=''
being equivalent.[fixes #429]