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

tests: fix seo-tap-targets in high DPI #14866

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions cli/test/fixtures/seo/seo-tap-targets.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
}
body {
margin: 0;

/* Without an explicit body font size, elements are more likely to have fractional sizes, which
complicates the tap target + finger overlap calculations. They can end up just 5% different
in different DPIs.
(Essentially caused by the the accumulation of rounding to integer css pixels for DPI=1)
*/
font-size: 14px;
}
</style>
<script>
Expand All @@ -39,7 +46,7 @@
It should not fail though because overlap with a sticky element depends on the scroll position.
</a>
</div>

<h1>SEO Tap targets</h1>

<!-- Invisible nodes don't cause failures -->
Expand All @@ -61,7 +68,7 @@ <h1>SEO Tap targets</h1>
</div>
<br/><br/>


<div style="overflow: hidden; position: relative">
<!-- Should be counted as visible although part of it is outside the scroll container -->
<a data-gathered-target="target-with-client-rect-outside-scroll-container">
Expand Down Expand Up @@ -95,15 +102,15 @@ <h1>SEO Tap targets</h1>

<br/><br/>

<!-- The left tap target has a large client rect that would normally overlap with the right tap target,
<!-- The left tap target has a large client rect that would normally overlap with the right tap target,
but the left link is overflow hidden, so there should be no failure. We should however
detect both tap targets (and not say the left one is invisible because the center of the big client rect is invisible) -->
<div style="overflow: hidden">
<a
data-gathered-target="child-client-rect-hidden-by-overflow-hidden"
style="display: block; height: 40px; width: 40px; background: #fca; float: left; overflow: hidden; position: relative;">
<div style="background: #afa; height: 40px; width: 80px; position: absolute; left: 30px">
left
left
</div>
</a>
<a
Expand All @@ -119,7 +126,7 @@ <h1>SEO Tap targets</h1>
data-gathered-target="child-client-rect-overlapping-other-target"
style="display: block; height: 40px; width: 40px; background: #fca; float: left; position: relative;">
<div style="background: #afa; height: 40px; width: 30px; position: absolute; left: 30px">
left
left
</div>
</a>
<a
Expand Down