w3c / IntersectionObserver

Intersection Observer
https://www.w3.org/TR/intersection-observer/
Other
3.62k stars 522 forks source link

Clarify root rect with overflow and padding. #504

Closed emilio closed 1 year ago

emilio commented 2 years ago

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

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?

miketaylr commented 2 years ago

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

emilio commented 1 year ago

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

tcaptan-cr commented 1 year ago

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.