-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiDataGrid] Fix sorting console errors + header cell focus cleanup/refactors #5209
[EuiDataGrid] Fix sorting console errors + header cell focus cleanup/refactors #5209
Conversation
Setting isCellEntered to true already makes that same call, so *should* have that same effect as long as we're consistent about changing logic via isCellEntered This also fixes elastic#4384, which was a focus-lock issue caused focusin/focusout events firing multiple times. Now with the setIsCellEntered change, focus does not fire repeatedly
- now that we're not calling enableInteractives and focusInteractives directly but letting isCellEntered handle that for us, there's no need to include them + setIsCellEntered isn't necessary either/doesn't trigger the lint rule
- Separate focus tests for isFocused logic vs focusin / focusout events
- Removes the need for useCallback and setting the utility fns as dependencies, simplifying code - refactor for loops to forEach's - remove setIsCellEntered(true) in focusInteractables, since it now only gets called when isCellEntered is true
- they don't get called separately, so it makes sense to optimize the call and not make an extra tabbables call (+ reduces unnecessary branching)
- covers last uncovered branch in file - move to bottom of the file rather than top, since after talking to Chandler this is an edge case that only applies to control header cells + remove `data-euigrid-tab-managed` attr - tests should pass without it
- convert functions to arrow functions - use shorter headerNode var instead of ref
- it's had no effect since we switched header cells to use a popover for actions
Preview documentation changes for this PR: https://eui.elastic.co/pr_5209/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving that #4384 will be fixed with this PR, tested in Chrome, Firefox, Safari, works as expected 👍
@chandlerprall or @thompsongl - any chance one of you can review at this PR sometime this week? Or alternatively, is @kertal's approval with the fix sufficient for merge? Thanks as always for your time! |
@@ -20,7 +20,7 @@ describe('EuiDataGridHeaderCellWrapper', () => { | |||
id: 'someColumn', | |||
index: 0, | |||
headerIsInteractive: true, | |||
children: <button data-euigrid-tab-managed="true" />, | |||
children: <button />, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, good catch!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; good fixes & refactors! ship it 🦑
Thanks Chandler!! |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5209/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5209/ |
Summary
This PR contains 2 console error fixes, a functionality removal that was already not working on master, several cleanup/refactors of the EuiHeaderGridCellWrapper focus code (that I noticed and wanted to work on while debugging/fixing the above bugs), and several unit test improvements. I strongly recommend following along by commit.
destination is null
error appears in the console:focusInteractives()
call and instead relying onsetIsCellEntered(true)
removes this lock/fight, because the state change does not repeatedly call itselfisFocused
conditional branch isn't even needed with current header cell behavior, but this is a pretty simple fix, so I'm leaving it as isQA
Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile(toolbar doesn't appear on mobile)- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for any docs examples- [ ] Checked for breaking changes and labeled appropriately