[EuiDataGrid] Fix sorting console errors + header cell focus cleanup/refactors#5209
Merged
cee-chen merged 12 commits intoelastic:masterfrom Sep 27, 2021
Merged
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/ |
Contributor
Author
|
@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! |
| index: 0, | ||
| headerIsInteractive: true, | ||
| children: <button data-euigrid-tab-managed="true" />, | ||
| children: <button />, |
chandlerprall
approved these changes
Sep 27, 2021
Contributor
chandlerprall
left a comment
There was a problem hiding this comment.
LGTM; good fixes & refactors! ship it 🦑
Contributor
Author
|
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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 nullerror appears in the console:focusInteractives()call and instead relying onsetIsCellEntered(true)removes this lock/fight, because the state change does not repeatedly call itselfisFocusedconditional 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