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

[data grid] Difference in cell tab&select behavior between v5 and v6 #12178

Open
Edelf opened this issue Feb 22, 2024 · 3 comments
Open

[data grid] Difference in cell tab&select behavior between v5 and v6 #12178

Edelf opened this issue Feb 22, 2024 · 3 comments
Labels
accessibility a11y component: data grid This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@Edelf
Copy link

Edelf commented Feb 22, 2024

The problem in depth

Considering the follow examples documentation:
v5: https://v5.mui.com/x/react-data-grid/editing/#row-editing
v6: https://mui.com/x/react-data-grid/editing/#row-editing

When editing a row, pressing TAB from one cell to another would auto-select the the cell value in v5, but not in v6.

I can't find anything about this in the migration guide, or how to achieve the same behavior in v6.

How can we achieve this?

Your environment

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: grid cell tab select
Order ID: 68154

@Edelf Edelf added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Feb 22, 2024
@zannager zannager added component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Feb 23, 2024
@michelengelen
Copy link
Member

This is actually different than the normal input behavior where an input that has text in it will select all of the text on focus. At first I thought this is a requirement for accessibility by WCAG standard, but it actually is not. From the WCAG docs:

  • When text fields receive focus, a vertical bar is displayed in the field, indicating that the user can insert text, OR all of the text is highlighted, indicating that the user can type over the text.
  • When a user interface control receives focus, a visible border is displayed around it.

In our case we support this standard by the second option already, so from a accessibility standpoint there is no need for action.

From a UX perspective this is a bit different and, IMO, highly opinionated. I myself do not like it when the text is selected in full when receiving focus.

If you still want to go back to the previous behaviour you could do this in 2 ways:

  1. Create your own custom edit component, where you have full control over the focus and all related events
  2. listen on the editing events, rowEditStart/cellEditStart. From there you can grab the input and select all text.

Option 2 is honestly a bit harder to accomplish.
Keep in mind that you are responsible for the tab-sequence when you provide custom components in the renderEditCell method. For reference: Tab sequence

Anything to add @MBilalShafi @romgrk ?

@michelengelen michelengelen changed the title [DataGrid] Difference in cell tab&select behavior between v5 and v6 [data grid] Difference in cell tab&select behavior between v5 and v6 Feb 23, 2024
@romgrk
Copy link
Contributor

romgrk commented Feb 25, 2024

The UX seems better for fully highlighted text, I'd be in favor of restoring that behavior.

@michelengelen
Copy link
Member

In that case I will add this to the board

@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: data grid This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

4 participants