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

fix(is-visible-on-screen): ignore elements hidden by overflow:hidden #3676

Merged
merged 7 commits into from
Oct 10, 2022

Conversation

straker
Copy link
Contributor

@straker straker commented Sep 26, 2022

This also fixes a bug in svg-non-empty-title that was discovered by this change in that it used visibleVirtual to get the title text. title elements aren't visible so it should instead use subtreeText and allow hidden elements.

For the previous overflowHidden function, I found that it was added to handle a screen reader only styling. I made sure the code still works with the new functionality.

Closes issue: #3247 and #2806

@straker straker requested a review from a team as a code owner September 26, 2022 17:12
Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

Mostly done, wrapping up for the day though.

lib/checks/shared/svg-non-empty-title-evaluate.js Outdated Show resolved Hide resolved
lib/commons/math/rects-touch.js Outdated Show resolved Hide resolved
lib/commons/math/rects-touch.js Outdated Show resolved Hide resolved
lib/commons/dom/visibility-methods.js Outdated Show resolved Hide resolved
ancestors.push(vNode);
}

return ancestors.concat(getOverflowHiddenNodes(vNode.parent));
Copy link
Contributor

Choose a reason for hiding this comment

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

Double points for the clean recursion 😄.

Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

Couple minor points

test/commons/math/rects-touch.js Outdated Show resolved Hide resolved
test/commons/math/rects-touch.js Outdated Show resolved Hide resolved

let rectA, rectB;
beforeEach(() => {
rectA = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not strictly necessary, but you could consider using DOMRect in these tests. (I only learned of these a week ago, otherwise I might've used them in target-size stuff.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a bad idea. If the tests were more complicated I might consider that, but since it's a simple test I'll just leave it as is.

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

Successfully merging this pull request may close these issues.

2 participants