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.

scrollTo element name does not scroll exactly to element

See original GitHub issue

document.getElementById(id).scrollIntoView(); works perfectly but scroller.scrollTo(id, { containerId: 'container' }) scrolls slightly above and I cannot correct it with offset because the mismatch is not fixed (ie. difference between correct position and scrolledPosition varies).

my Elements are .map()ped like with following render() : <Element name={doc._id} id={doc._id}>content</Element>.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
panmonacommented, Apr 17, 2019

Had this issue aswell in the current version. Thanks to the code in the linked PR I figured out that I needed to set position: relative on the container.

1reaction
fisshycommented, Jan 4, 2019

Feel free to make a PR, I Haven’t had the time to fix this yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I scroll to an element using JavaScript? - Stack Overflow
Chrome (WebKit) has a bug which causes the page not to scroll once the anchor is set. Use: location.href="#";location.href="#myDiv" . Using id=" ...
Read more >
Element.scrollTop - Web APIs | MDN
The Element.scrollTop property gets or sets the number of pixels that an element's content is scrolled vertically.
Read more >
HTML DOM Element scrollTop Property - W3Schools
The number of pixels the element's content is scrolled vertically. If the number is negative, the number is set to 0. If the...
Read more >
How to Scroll into view in Selenium Webdriver
It was a little challenging to scroll for each element. In Selenium we can do this with scrollIntoView(true) which can scroll automatically till ......
Read more >
Scroll a React component into view - Robin van der Vleuten
scrollIntoView() . Which does exactly what it says it does with a few nice options to modify its behavior. Scroll to element with...
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