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

IntersectionObserver with filters #509

Open
wangxianzhu opened this issue Jun 26, 2023 · 1 comment
Open

IntersectionObserver with filters #509

wangxianzhu opened this issue Jun 26, 2023 · 1 comment

Comments

@wangxianzhu
Copy link

I don't find mention of filters in the spec when calculating the intersection rect. Browsers are inconsistent. Chrome considers filters, which doesn't follow the spec. Firefox doesn't consider filters, which follows the spec.

Test case:

<!DOCTYPE html>
<div id="root" style="width: 200px; height: 200px; overflow: scroll">
  <div style="height: 300px"></div>
  <div id="target" style="width: 100px; height: 100px; background: green; filter: blur(30px)"></div>
  <div style="height: 300px"></div>
</div>
<pre id="output" style="height: 200px"></pre>
<script>
root.scrollTo(0, 90);
let observer = new IntersectionObserver((entries, observer) => {
  let e = entries[0];
  output.textContent += '=========OBSERVE' +
      '\nbondingClientRect=' + JSON.stringify(e.boundingClientRect) +
      '\nrootBounds=' + JSON.stringify(e.rootBounds) +
      '\nintersectionRect=' + JSON.stringify(e.intersectionRect) +
      '\nintersecting=' + e.isIntersecting +
      '\nintersectionRatio=' + e.intersectionRatio;
}, {root: root});
observer.observe(target);
</script>
@wangxianzhu
Copy link
Author

@szager-chromium I think we need a flag to prevent visual rect mapping from expanding visual rect for pixel-moving filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant