mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
196092ae69
* 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
89 B
89 B
astro |
---|
patch |
Fix toolbar audit incorrectly flagging images as above the fold.