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] Allows to use keyboard navigation even with no rows #4302

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

alexfauquette
Copy link
Member

Fix the following bug: #4280 (comment)

  • Go in codesandbox.io/s/datagridprodemo-material-demo-forked-8e4l8w
  • Click on a column header
  • Press Arrow Right to navigate to the last column
  • You are not able to do it because there is no row in the grid

@mui-bot
Copy link

mui-bot commented Mar 29, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 240.8 501.1 468.6 392.82 116.224
Sort 100k rows ms 491.7 1,115.1 830.6 822.22 197.779
Select 100k rows ms 138.7 219.7 204.3 190 28.716
Deselect 100k rows ms 112.2 239.2 146.7 154.5 46.279

Generated by 🚫 dangerJS against bf83012

@alexfauquette alexfauquette requested a review from m4theushw March 29, 2022 12:42
'.MuiDataGrid-virtualScroller',
)! as HTMLElement;
expect(virtualScroller.scrollLeft).to.equal(0);
fireEvent.keyDown(document.activeElement!, { key: 'ArrowRight' });
Copy link
Member

Choose a reason for hiding this comment

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

To able to re-enable the ESLint rule in the future.

Suggested change
fireEvent.keyDown(document.activeElement!, { key: 'ArrowRight' });
fireEvent.keyDown(getColumnHeaderCell(0), { key: 'ArrowRight' });

Copy link
Member Author

Choose a reason for hiding this comment

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

@m4theushw are you talking about the following line?

// @ts-ignore Remove once the test utils are typed

The file is full of those document.activeElement! should I remove them?

Copy link
Member Author

Choose a reason for hiding this comment

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

I merged because it's not related to the bug. If moving from document.activeElement to getter methods, I will do a distinct PR cleaning the all file

Copy link
Member

@m4theushw m4theushw Mar 30, 2022

Choose a reason for hiding this comment

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

I was talking about

/* eslint-disable material-ui/disallow-active-element-as-key-event-target */

It's good to not use document.activeElement in new tests. In the future there will be less tests to change.

The file is full of those document.activeElement! should I remove them?

The remaining ones can be done later since it's not the purpose of this PR.

@m4theushw m4theushw added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! labels Mar 29, 2022
@alexfauquette alexfauquette merged commit e22e42f into mui:master Mar 30, 2022
@alexfauquette alexfauquette deleted the fix-scroll-no-row branch March 30, 2022 08:33
alexfauquette added a commit to alexfauquette/mui-x that referenced this pull request Aug 26, 2022
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.

3 participants