w3c/IntersectionObserver

Clarify root rect with overflow and padding.

emilio opened this issue · 3 comments

https://w3c.github.io/IntersectionObserver/#intersectionobserver-root-intersection-rectangle says to use the "content area" when the element has scrollable overflow, however this seems wrong when there's padding.

Consider this test-case: https://codepen.io/jelmerdemaat/pen/wvjLMRN

  • WebKit and Blink implement the spec to the letter.
  • Firefox implements what I think is better behavior: The intersection root rect is the scrollport rect, not the content rect.

Unless I'm missing something, the intent of the spec is to not include the scrollbar and borders, but I believe the correct behavior is Firefox's.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1796268

@miketaylr @szager-chromium do you agree?

With my webdev hat on, I find Firefox's implementation to be less surprising. @szager-chromium WDYT?

Cc @tcaptan-cr, wonder if there's any opinion here. I think this is an obvious spec bug / oversight.

Cc @tcaptan-cr, wonder if there's any opinion here. I think this is an obvious spec bug / oversight.

I agree that the scrollport rect would be better.