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.

List: broken rendering if scrolling while `display: none` is set + not scrolling to the right element

See original GitHub issue

Steps to reproduce:

  • Have a list
  • Scroll it
  • Filter it
  • Even if the new filtered list is not long enough to be scrollable react-window still thinks that it is scrolled, and some rows might not get rendered

I’ve made a video showcasing this here.

Until this is fixed I think I’ll either have to render the list twice by forcing an update of scrollOffset by triggering a scroll event, or manually setting scrollTop = 0 before each filtering round or something.

scroll_offset.mp4.zip

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bvaughncommented, Feb 16, 2019

Looks like something funky is going on with your params (like maybe you aren’t updating the itemCount or something). Unless you can provide a repro, I can’t really help here.

I’m going to close this for now because I don’t like keeping unactionable issues open. We can keep talking though, and I’ll be happy to look at a repro if you can share one.

0reactions
hardnoldcommented, Nov 25, 2020

I’m having a similar problem (not the exact same one, but still related to display: none).

I have a toggle-Link which shows and hides a container with display: none and display: block.

          <p className={classes.tip} onClick={ this.toggleTip }>
            Toogle Text
          </p>
          <div className={classes.tipToggle} style={this.state.toggleOpen ? { display : 'block' } : { visibility : 'hidden' }}>
            <ol style={{ paddingLeft : '15px' }}>
              <li>Item 1</li> 
              <li>Item 2</li>
              <li>Item 3</li>
            </ol>
          </div>
toggleTip = () => {
    this.setState({ toggleOpen : !this.state.toggleOpen })
  }

On the same page I have an Input which triggers a live search after each keystroke and therefor updates the state.

If the toggle is closed, the page keeps scrolling to the top after each keystroke. If the toggle is closed, the page doesn’t scroll and the Input stays at the same position (latter is the expected and wanted behavior).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent body scrolling but allow overlay scrolling
The div inside the overlay is in position: static so the vertical scrollbar is related to that element. This is resulting in a...
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >
Element size and scrolling - The Modern JavaScript Tutorial
Properties scrollLeft/scrollTop are the width/height of the hidden, scrolled out part of the element. On the picture below we can see ...
Read more >
content-visibility | CSS-Tricks
Think of it sort of like lazy loading in the sense that an off-screen element's children are not rendered until they enter the...
Read more >
.scroll() | jQuery API Documentation
The scroll event is sent to an element when the user scrolls to a different place in the element. It applies to window...
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