question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider adding `rootMargin` to the Intersection Observer

See original GitHub issue

Feedback from @surma:

I feel like by default you should add a rootMargin to the IO to trigger the load before something comes into the viewport.

So, rootMargin defaults to “0px 0px 0px 0px”, meaning the intersection will be computed between the root element’s unmodified bounds rectangle and the target’s bounds. This change would be made to https://github.com/GoogleChromeLabs/quicklink/blob/master/src/index.mjs#L21

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aretheregodscommented, Dec 14, 2018

@lukeed @addyosmani I’d be happy to do whatever is needed. I’ll make a PR once I’m done.

Edit: I’m getting a microbundle related jsx error that I need to investigate. Once I fix that, I’ll make a PR.

1reaction
addyosmanicommented, Dec 13, 2018

@lukeed Mostly me being overscrupulous 😇

I haven’t measured IO initialization costs so don’t have a good mental model of whether this shift practically changes anything. Let’s move ahead 👍I’ll flag if any concerns can be backed up with data.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntersectionObserver.rootMargin - Web APIs | MDN
The IntersectionObserver interface's read-only rootMargin property is a string with syntax similar to that of the CSS margin property.
Read more >
Use IntersectionObserver with rootMargin to change when ...
I'm completely flummoxed by the rootMargin property of intersection observer. My goal is to add a class to an element when half it's...
Read more >
JavaScript Intersection Observer Ultimate Guide
The rootMargin will be added to the container viewport so in essence we can shrink/grow our view port with this value. const observer...
Read more >
master the `rootMargin` option in intersection observer.
A possible solution is to add a margin-left for the first item and a margin-right for the last item of marginWidth , then...
Read more >
IntersectionObserver.rootMargin - Web APIs
The IntersectionObserver interface's read-only rootMargin property is a string with syntax similar to that of the CSS margin property.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found