IntersectionObserver TPAC 2020 Breakout

Agenda

Present

(Full name, IRC nickname, affiliation, other relevant info)

Meeting notes

Topic: Allow dynamically changing rootMargin (#428)

Topic: Ability to have automatic rootMargin for all nested scroll containers (#431)

Zcorpan: As you can see from the demo… (Demo: https://lazy-img-demo.glitch.me/ ) lazy image loading works differently in the main document than inside a scrollable region. In chrome, in a scrollable region we wind up only loading when the image is actually scrolled into view.  In the main document it has some buffer of a thousand pixels.  Images in a scroll container are actually quite common - that's how carousels are done, for example, typically.

Emilio: makes sense, should be straightforward to implement. Only reasonable behavior is to resolve once, for the root. If things change (missed something). Obvious approach would be to add a member to the dictionary when initializing. Whether we want to make it mutable, no strong opinion.

smfr: proposal is to apply rootMargin to all scrollers, then logic does rect intersection ?

Emilio: the way we impl in gecko, go up the chain and check intersections. Want to apply the margin in all intermediate steps. there was a question about clip paths

smfr: makes sense… do we want the same rootMargin on all scrollers?

Emilio: I was thinking same rootMargin everywhere… Dunno. Changes the shape of the API otherwise

smfr: does it expand on both axis?

smfr: I don’t think it makes sense to expand on the direction a box is not scrollable…

zcorpan: I think that doesn’t matter much

smfr: thinking of a horizontal scroller, does it make sense to expand in the other direction?

emilio: doesn’t matter I think. Hmm actually, I’ve seen pages that rely on non-zero margins. Image couldn’t intersect because it’s 0x0 and can’t intersect.

smfr: sounds like expanding on both axes is reasonable. Open question : what happens if you have an overflow: hidden ?

emilio: intersect with overflow: clip? I don’t know what it does now.

zcorpan: I don’t think overflow: hidden matters much one way or another

smfr: agree

smfr: current proposal is to apply the rootMargin … would be a step, if container is scrollable, expand cliprect by rootMargin

Emilio: has to be opt-in. Don’t know if pages rely on current intersectionobserver behavior

zcorpan: remember a special-case with cross-origin iframes. Do we need to consider that here?

emilio: I think if we apply the same rootMargin we would also need to not apply it to cross-origin iframes.

zcorpan: may provide an API to specify different rootMargin for different scrollers

emilio: maybe a css property? might be hard to implement. Don’t know how to do it in the API. should be part of the scroller itself.

zcorpan: might add a lot of complexity, maybe not that useful?

smfr: for an image carousel… suddenly you’re loading all images in the carousel. if the carousel has scrollSnap, such that you can’t go further than a small step at a time, having a big margin is bad.

emilio: maybe can use percentages. Would be different for different scrollers.

zcorpan: so then the browser would need to use percentages for lazy-loading

smfr: JS libraries allow customization?

zcorpan: yes. through data- attributes, per-image basis or ancestors (maybe?)

smfr: might need more experimentation, with image carousels and scroll snap and such

smfr: Next steps: experiment to figure out - some testing with vertically scrolling pages and horizontal carousels. are lazy images too aggressively loaded? Pages like music.apple.com , don’t interact with all images. If we turn this on, too many images load?

bkardell: question. Does this mean they’re loaded with script?

smfr: yes.

bkardell: so this wouldn’t be a good default, would be too aggressive?

smfr: I can ask the devs for music.apple.com what would be acceptable

zcorpan: thanks!

bkardell: if we were to add lazy images as they are today, to that page, it wouldn’t be aggressive enough?

smfr: yeah. Has some margin

zcorpan: wonder if default vertical and horizontal margins should be different?

smfr: dunno, there are pages with horizontal scrolling