This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Add onScrollStart callback #147
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
onScrollStartcallback to be paired with FixedDataTable's existingonScrollEnd.Problem
In order to add a hover state to a row we need to redraw when the mouse enters and leaves each row. This can be done using css hover or using the Table's
onRowMouseEnterandonRowMouseLeave. The problem with both of these options is that when mouse wheel scrolling no native mouse leave event seems to fire from the browser (seen at least in FF, Chrome, Safari). This means as the row scrolls off it remains in hovered state even though the mouse is no longer over it. I believe this is a translate/translate3d bug or optimisation.Only when you move the mouse again does hover state update. This also means that when you stop wheel scrolling the row under the mouse does not draw its hovered state until you move the mouse.
As mentioned in #17 css hover is preferred for performance reasons, but even if that did work properly you'd still be sacrificing some performance due to constant redraws during scrolling.
Solution
When
onScrollStartfires remove current hover state and disable hover updates untilonScrollEnd.As a side note, in order to reapply the hover state when wheel scrolling stops I track the mouse position while the table is mounted and when
onScrollEndfires I do some basic hit detection based on the scroll position to determine which row is under the mouse.Maybe there's a simpler solution for all this? For now this was the only way I could find to get bug free + performant hover states.