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: audit incorrectly flagging images as above the fold (#12993) #12998

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Kynson
Copy link

@Kynson Kynson commented Jan 17, 2025

Changes

Testing

No tests are added (manual testing is done locally), as I am not familiar with playwright and the fix is trivial. Please help me to add some tests if it is necessary.

Docs

Docs update should not be necessary.

Copy link

changeset-bot bot commented Jan 17, 2025

🦋 Changeset detected

Latest commit: f657b1f

The changes in this PR will be included in the next version bump.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 17, 2025
Copy link

codspeed-hq bot commented Jan 17, 2025

CodSpeed Performance Report

Merging #12998 will not alter performance

Comparing Kynson:main (f657b1f) with main (429aa75)

Summary

✅ 6 untouched benchmarks

@ascorbic
Copy link
Contributor

Does this mean that the other fix proposed in #10891 and implemented in #11617 didn't work?

@Kynson
Copy link
Author

Kynson commented Jan 17, 2025

As far as I can tell, the fix implemented in #11617 can't handle all situations (as mentioned in my original issue).

However, there were two different fix proposed in #10891:

  1. The one implemented in fix: audit incorrectly flagging images as above the fold (#10891) #11617 (depending on window.scrollY)
  2. The one submitted in this PR

While the second fix is more complicated than the fix in #11617, but according to my testing, it can also handle the situation which the image is a descendent of a scrolling container other than body

@ascorbic
Copy link
Contributor

ascorbic commented Jan 17, 2025

It would be fantastic if you could get a test in for this. I think it's clear that there are edge cases which the other PR didn't catch, which is why an e2e test would be just what's needed. There is already a suite testing the audits, so you could add a case in there:

https://github.com/withastro/astro/blob/main/packages/astro/e2e/dev-toolbar-audits.test.js

The fixture is here, where you could add something like the page you manually tested with:

https://github.com/withastro/astro/blob/main/packages/astro/e2e/fixtures/dev-toolbar

@Kynson
Copy link
Author

Kynson commented Jan 17, 2025

Thanks for the links! I am happy to write some e2e tests if the team doesn't mind I might need some time to get familiar with playwright.

@ascorbic
Copy link
Contributor

No rush. Playwright is pretty nice to work with, so it shouldn't be too hard to get started though.

@Kynson
Copy link
Author

Kynson commented Jan 18, 2025

I have added some tests:

Please tell me if more edge cases are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toolbar audit incorrectly flag images as above the fold
2 participants