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.

Scrolling timeout hover performance issue

See original GitHub issue

In my particular case I use the Table element and I have to set the hovered row index to the component state in order to activate special functionality in my sub-components that are rendered inside of a table row.

The hovered row index is set by using the provided onRowMouseOver prop of the Table component.

When scrolling sometimes the hover event takes several seconds to kick in (up to 2 to 3 seconds(!)) and prevents the table from being able to be hovered during that time span which is horrible for user experience as it can be seen in the following gif (note that I did not slow down, this is realtime)

hover_delay

The issue only occurs in chrome as far as i could test it, other browsers like Edge or Firefox do not have that issue. Another strange behavior of the problem is, that it seems to resolve itself. After a certain amount of time playing around with the table by scrolling and hovering over some rows the hover events behave as they should. When the page is reloaded the issue comes back though.

After research I came to the conclusion that this issue might relate to the issues #564 #322 and maybe #518 but I thought I have to open a new issue as there is no issue that exactly covers my use case.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
gnbaroncommented, Jun 19, 2017

I’m having this same issue on my project that I’m using the Grid component. I need use the isScrolling value to know how my element is rendered, but the scroll callback is having 1.5s ~ 2s of delay to be called.

Like some people already said in this kind of issue, this is happening because the browser is delaying the setTimeout callback on _debounceScrollEnded in exchange of performance reasons.

There are plans to someone work on it ?

I tested an workarround on my project using requestAnimationFrame instead of setTimeout and works fine, but I don’t know if this is the best way to do that. I was thinking in something like this:

// I just wrote it as draft, needs to be tested and refactored
_debounceScrollEnded() {
  const { scrollingResetTimeInterval } = this.props

  if (this._disablePointerEventsTimeoutId) {
    cancelAnimationFrame(this._disablePointerEventsTimeoutId)
    this._scrollDebounceStart = Date.now();
  }

  const delay = function() {
    if (Date.now() - this._scrollDebounceStart >= scrollingResetTimeInterval) {
      this._debounceScrollEndedCallback();
      this._scrollDebounceStart = Date.now();
    } else {
      this._disablePointerEventsTimeoutId = requestAnimationFrame(delay);
    }
  }

  delay.bind(this);

  this._disablePointerEventsTimeoutId = requestAnimationFrame(delay);
  this._scrollDebounceStart = Date.now();
}
2reactions
bvaughncommented, Jun 7, 2017

If overriding the pointer-event style doesn’t resolve the issue you’ve described, then I assume something else is going on in your application (or you’re doing it incorrectly). You could provide a Plnkr, as the new-issue template requests for bug reports:

Are you reporting a bug or runtime error?

Please include either a failing unit test or a Plnkr demonstrating the bug you are reporting. You can start by forking this Plnk! https://plnkr.co/edit/6syKo8cx3RfoO96hXFT1

Your tone sounds a bit aggressive to me. Perhaps I’m interpreting it incorrectly. But please remember that I created this library and support it (by responding to issues like this) in my spare time, for free.

Here’s a Plnkr that shows the workaround working: https://plnkr.co/edit/rzOpcO?p=preview

If it doesn’t work for your application, you’ll need to at least provide a repro case where I can see it not working before I’ll look into it any further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

All grid actions (checkbox, hover, scrolling, editing) are slowed ...
Problem is, when all the rows are rendered, the grid is slowed and lagged beyond use; hover states are not matching between fixed...
Read more >
Web Optimization: Increasing FPS by Disabling Hover Effect
Disabling the Hover Effect While User Is Scrolling. The goal here is to minimize browser reflow and repaint events to increase the frame...
Read more >
Disable hover on scroll to prevent browser repaint
I want this hover effect to not be triggered when the user is scrolling the page, to not force the browser to repaint/reflow....
Read more >
Frustrating Design Patterns: Mega-Dropdown Hover Menus
The user starts scrolling down slowly to assess the content on a page, but the menu keeps popping up. And every time the...
Read more >
60fps scrolling using pointer-events: none - Ryan Seddon
The gist of the technique is on scrolling the .hover class is removed from the body and all your .hover selectors won't match...
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