Skip to content
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] Sorting columns after focusing a header cell throws console errors #4384

Closed
Tracked by #85965
kertal opened this issue Dec 15, 2020 · 4 comments · Fixed by #5209
Closed
Tracked by #85965

[EuiDataGrid] Sorting columns after focusing a header cell throws console errors #4384

kertal opened this issue Dec 15, 2020 · 4 comments · Fixed by #5209
Assignees

Comments

@kertal
Copy link
Member

kertal commented Dec 15, 2020

When you sort columns after you've selected a header cell, there are lot's of errors in console. Seems there is a problem with focus in this case:
image

The only reliable way to reproduce it was using Safari, but it also happened in Chrome (Reported by @majagrubic)
elastic/kibana#67259 (comment)

Steps to reproduce

  1. Open https://elastic.github.io/eui/#/tabular-content/data-grid in Safari
  2. Click on the Name header
  3. Click on Columns
  4. Change position of the 2 Name and Email Adresse - should take a while
  5. Have a look at console
@chandlerprall
Copy link
Contributor

I'm curious why the header's popover remains open when interacting with the column position popover, but that appears unrelated - confirmed this focus error happens even if the header cell's popover is closed before re-ordering columns.

@kertal
Copy link
Member Author

kertal commented Aug 18, 2021

tested it and it's still an issue

@cee-chen cee-chen self-assigned this Sep 21, 2021
cee-chen added a commit to cee-chen/eui that referenced this issue Sep 21, 2021
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
@cee-chen
Copy link
Member

@kertal Hey hey! If you have time, would you mind quickly QA testing https://eui.elastic.co/pr_5209/#/tabular-content/data-grid to confirm that the issue is fixed in my PR? 🙏

@kertal
Copy link
Member Author

kertal commented Sep 23, 2021

ACK .. testing

cee-chen pushed a commit that referenced this issue Sep 27, 2021
…refactors (#5209)

* [Fix] Fix console error when dragging to reorder columns

* [Fix] DRY out enableInteractives call

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 #4384, which was a focus-lock issue caused focusin/focusout events firing multiple times. Now with the setIsCellEntered change, focus does not fire repeatedly

* [Refactor] Remove unnecessary useEffect dependencies

- 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

* [Refactor] Improve focus unit tests

- Separate focus tests for isFocused logic vs focusin / focusout events

* [Refactor] Move interactive fns to separate/external fns vs. useCallback

- 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

* [Refactor] Combine enable and focus interactives action

- they don't get called separately, so it makes sense to optimize the call and not make an extra tabbables call (+ reduces unnecessary branching)

* [Refactor] More complete multiple interactive children unit tests

- 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

* [Refactor] Misc cleanup

- convert functions to arrow functions
- use shorter headerNode var instead of ref

* [Fix] Remove F2 key event

- it's had no effect since we switched header cells to use a popover for actions

* Add changelog entry

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants