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
…1617) * 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
- Loading branch information