-
Notifications
You must be signed in to change notification settings - Fork 776
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
feat: Add shadow DOM to duplicate-img-label check #443
Conversation
// Get all visible images in the composed tree of the current node | ||
const images = axe.utils.querySelectorAll(virtualNode, 'img') | ||
// Ignore hidden or role=none/presentation images | ||
.filter(({ actualNode }) => (axe.commons.dom.isVisible(actualNode) && |
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.
@dylanb Not sure if this was a bug, or if this is intentional. isVisible
has a screenreader flag, should this function use that flag? I'm not sure why we care here if the image is positioned off screen or not. Thoughts?
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.
forcing to boolean (plus undefined) would be better than the truthy return value but not required
|
||
return false; | ||
// See if any of the images duplicate the node's text | ||
return images.some(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.
Shouldn't this be !!
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.
array.some returns a boolean.
var node = axe.utils.querySelectorAll(axe._tree[0], target || '#target')[0]; | ||
|
||
var node; | ||
if (typeof target === 'string') { |
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.
We needed this testutils file after all 👍
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.
Yeah, this is very nice to have hanging around.
* feat: Add shadow DOM to duplicate-img-label check * fix: Use tabs
Should close #430.