0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00
astro/packages
Abu Bakr 196092ae69
fix: audit incorrectly flagging images as above the fold (#10891) (#11617)
* fix: audit incorrectly flagging images as above the fold (#10891)

Previously used lement.offsetTop to find the y position of the image, which does not work when the element parent has a position: relative property.
Instead, this uses lement.getBoundingClientRect().y top get real y position of the image.
There's one issue though, which is that getBoundingClientRect returns the position relative to the user's viewport, not the absolute position.
So, add window.scrollY to the value to cancel that effect out, and you have the element's absolute position.

https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY

* chore: add changeset
2024-08-05 13:29:20 +02:00
..
astro fix: audit incorrectly flagging images as above the fold (#10891) (#11617) 2024-08-05 13:29:20 +02:00
astro-prism chore(deps): update all non-major dependencies (#10958) 2024-05-09 15:20:13 +08:00
astro-rss fix(deps): update all non-major dependencies (#11565) 2024-07-31 21:17:26 +08:00
create-astro [ci] release (#11524) 2024-07-30 11:54:54 -04:00
db fix(deps): update all non-major dependencies (#11618) 2024-08-05 16:22:43 +08:00
integrations fix(deps): update all non-major dependencies (#11618) 2024-08-05 16:22:43 +08:00
internal-helpers [ci] release (#11297) 2024-06-24 12:49:52 -04:00
markdown/remark fix(deps): update all non-major dependencies (#11618) 2024-08-05 16:22:43 +08:00
studio fix(deps): update all non-major dependencies (#11565) 2024-07-31 21:17:26 +08:00
telemetry fix(deps): update all non-major dependencies (#11565) 2024-07-31 21:17:26 +08:00
underscore-redirects [ci] release (#11297) 2024-06-24 12:49:52 -04:00
upgrade fix(deps): update all non-major dependencies (#11522) 2024-07-23 11:43:14 +08:00