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

[DataGrid] Fix browser keyboard shortcuts not working when header cell is focused #3692

Merged
merged 5 commits into from Jan 26, 2022

Conversation

valenfv
Copy link
Contributor

@valenfv valenfv commented Jan 22, 2022

Fixes #3477 by only preventing default for non registered shortcuts. This behavior applies both for cells and column headers.

Preview: https://deploy-preview-3692--material-ui-x.netlify.app/components/data-grid/demo/

The issue

When a cell / header cell had focus, no keyboard shortcuts would work. The problem was on the useGridKeyboardNavigation hook which was event.preventDefault() to any key press.

The solution

Only prevent default behavior to shortcuts / keys we are expecting.

Solution provided by @m4theushw

@mui-bot
Copy link

mui-bot commented Jan 22, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 180.8 208.2 194.6 194.82 9.961
Sort 100k rows ms 312.9 615.7 503 486.8 97.699
Select 100k rows ms 129.3 279.6 183 182.62 54.805
Deselect 100k rows ms 101.2 195.4 179.7 153.88 41.224

Generated by 🚫 dangerJS against 8454626

@cherniavskii cherniavskii changed the title [DataGrid] Fix prevent default for non registered shortcuts [DataGrid] Fix browser keyboard shortcuts not working when cell is focused Jan 26, 2022
@cherniavskii cherniavskii added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! labels Jan 26, 2022
@cherniavskii cherniavskii changed the title [DataGrid] Fix browser keyboard shortcuts not working when cell is focused [DataGrid] Fix browser keyboard shortcuts not working when header cell is focused Jan 26, 2022
Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] CMD + R keyboard event get ignored when the column header cell is focused.
3 participants