-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table component sorts and rerender on onmouseover and onmouseout #1291
Comments
Thanks for reporting @AndreeWille, I can reproduce easily using by logging The issueThis is happening because we listen to The mouse enter and leave events update the The solution(s)One way we can solve this is by avoiding to call Alternatively, we could also remove the logic to highlight the entire column when the header cell is hovered: I don't think that this behavior is a big usability improvement, and it definitely worsens the component's performance and maintainability (as illustrated by this very issue), not to mention that it breaks the comparable experience principle of inclusive design by not implementing the same behavior for keyboard users. If we were to remove these Side note: this is a legacy component and it will be entirely rewritten in an upcoming release. We will consider future bug fixes to the extent possible, but we can't prioritize them at this time. PRs are always welcome though 🙌 |
☝️ a PR with a suggested fix is here. Try it on the deploy preview. |
Closed by #1292, the fix is in Thanks again for the report @AndreeWille! |
Thank you @robinmetral for fixing this so quickly! |
The fix for the Table re-render had a bug, which was addressed in #1306. However it looks like it reintroduced the re-render on Table header hover: reopening. |
I had a look into this and came to the conclusion that the issue is that hovering over a table header changes the state of the table in order to store the column index, which results in rerendering the table. If yes, then i would be happy to prepare a pr where i remove the state change but instead add the html col tag according to the amount of headers and then dynamically set the background color on col when hovering. This should have the same effect. Would this make sense to you? |
Yes, exactly
I'm not sure, but we can try to remove it! A PR would be awesome, then we can make sure all tests pass and test the component in the Storybook. Let me know if you need help getting set up with the repo 🙂 (Start here) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Add a comment explaining why the issue is still relevant to prevent it from being closed. |
Describe the bug
On a sortable column when you put the mouse over or away from the header of the column that is sortable then the table gets sorted and rerendered. Which means that when a user clicks on a header with a the property sortable = true and afterwards moves the mouse away from the header then the table gets sorted 3 times. First time on onMouseOver, 2nd time on onClick and 3rd time on onMouseOut.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
Table will only be sorted once when a user clicks on the table header.
Specifications
Additional context
The text was updated successfully, but these errors were encountered: