Lose focus when filtering rows with grouping
Describe the bug
I use the datagrid with the grouping example of the website, I added a custom filter outside of the component that filter on a specific column. The rows are updated inside a useMemo with "filters" and "rows" in dependencies.
Everything work as expected when rows are not grouped, but when I group them I got unexpected behavior (lose focus -depends on the character-, sometimes crash with TypeError: Cannot read properties of undefined (reading 'editorOptions')).
To Reproduce
- row grouping
- input that filter on a specific column outside of the datagrid
Expected behavior
Environment
react-data-gridversion: ^7.0.0-beta.7react/react-domversion: ^17.0.2
For example, there is row with group name = Utilities. If I search something starting with 'u' it will focus the cell with the name utilities and lose focus on my text input. On can I prevent this behavior ?
If I extend all the other group I do not lose focus btw.
We have also run into this lose focus behavior when we tried upgrading from 7.0.0-canary.49 to 7.0.0-beta.5. We recently tried again with 7.0.0-beta.7 and the issue persists.
For our case, the unexpected lose focus behavior occurs within an editable grid via the following workflow:
- Highlight a cell in the grid:
- Enter data in a separate search bar control:
- After typing a few characters, the focus is lost in the search bar and a cell in the grid becomes focused