Click events not always registering for Rows when scrolling fast
See original GitHub issueSo I have created a basic ListBox using react-window
and everything is rendering great!
One problem I have however is that if I scroll the list and right after scrolling click on an item it’s click handler (a div
in this case) is not always invoked.
My guess is that I click before the item has been properly rendered and placed on the screen. Does this sound plausible?
Maybe if the FixedSizeList
could have it’s own click handler that could calculate which items should have been clicked in case it has not been rendered fully yet?
Is there any strategy or workaround for these kinds of problems? Is it a known issue?
Thanks for a great library!
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
android - Click event during scrolling of LazyRow not registered
I have 2 LazyRows and a button. During scrolling of LazyRow A, I can click on the button without a problem, but when...
Read more >Be Slightly Careful with Sub Elements of Clickable Things
Sometimes if you need 1000 click events on table rows it's better to have one single event with delegation (you don't have to...
Read more >Smooth Scrolling in Excel for Windows
First, it's smoother during the scroll when using either the mouse wheel* or the scrollbars (touch screen and touch pad already scrolled ...
Read more >Document: scroll event - Web APIs - MDN Web Docs - Mozilla
The scroll event fires when the document view has been scrolled. To detect when scrolling has completed, see the Document: scrollend event.
Read more >Handling Events :: Eloquent JavaScript
If a button inside a paragraph is clicked, event handlers on the paragraph ... was clicked, rather than register individual handlers on all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just want to chime in that I just got a bug report about this in our app and am now applying this as a workaround
@johot Here’s a codesandbox that kinda does what you were talking about with the virtualized onClick but outside of the library. I didn’t think too hard about it but it seems to work? It tracks scroll position through the
onScroll
callback, and attaches anonClick
handler to a container div that calculates the item under the cursor.Edit: I’m dumb, this needs to take into account the container position, so an actual working impl also needs a ref on the container and to use getBoundingClientRect.