-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…2998) * fix: audit incorrectly flag images as above the fold (#12993) * chore: add changeset * Add additional tests for perf audit
- Loading branch information
Showing
6 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes the issue that audit incorrectly flag images as above the fold when the scrolling container is not body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/astro/e2e/fixtures/dev-toolbar/src/pages/audits-perf-absolute.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
import { Image } from "astro:assets"; | ||
import walrus from "../light_walrus.avif"; | ||
--- | ||
<div style="height: 9000px;"></div> | ||
<div style="position:absolute;top:0;left:0"> | ||
<Image src={walrus} loading="lazy" alt="A walrus" /> | ||
</div> | ||
<div style="height: 9000px;"></div> |
38 changes: 38 additions & 0 deletions
38
packages/astro/e2e/fixtures/dev-toolbar/src/pages/audits-perf-body-unscrollable.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
import { Image } from "astro:assets"; | ||
import walrus from "../light_walrus.avif"; | ||
--- | ||
|
||
<body> | ||
<div id="scroll-container"> | ||
<Image src={walrus} loading="lazy" alt="A walrus" /> | ||
<div style="height: 9000px;"></div> | ||
|
||
<Image src={walrus} loading="lazy" alt="A walrus" /> | ||
<button id="mutation-button">Mutation</button> | ||
<div style="height: 9000px;"></div> | ||
</div> | ||
</body> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
height: 100dvh; | ||
overflow-y: hidden; | ||
} | ||
#scroll-container { | ||
height: 100dvh; | ||
overflow-y: auto; | ||
} | ||
</style> | ||
|
||
<script> | ||
const mutationButton = document.getElementById('mutation-button'); | ||
mutationButton?.addEventListener('click', () => { | ||
const dummyElement = document.createElement('div'); | ||
document.body.appendChild(dummyElement); | ||
|
||
console.log('mutation'); | ||
}); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
packages/astro/e2e/fixtures/dev-toolbar/src/pages/audits-perf-relative.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
import { Image } from "astro:assets"; | ||
import walrus from "../light_walrus.avif"; | ||
--- | ||
|
||
<div style="height: 9000px;"></div> | ||
<div style="position:relative"> | ||
<Image src={walrus} loading="lazy" alt="A walrus" /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters