mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.05k stars 1.25k forks source link

[data grid] Copy & Paste on Cells using localize keyboard #14219

Open rotembarsela opened 4 weeks ago

rotembarsela commented 4 weeks ago

Steps to reproduce

Link to live example: (required) https://mui.com/x/react-data-grid/clipboard/

Steps:

  1. Copy&Paste working using only English localization Keyboard
  2. Using Hebrew for example will not work, because the function is looking for the "v" key, instead of the KeyC
  3. inside packages\x-data-grid-premium\src\hooks\features\clipboard, handleCopy func: https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/hooks/features/clipboard/useGridClipboard.ts
  4. same thing for the paste shortcut, image

Current behavior

English language localization - Copy&Paste work Changing to other Language (Computer) - Copy&Paste fail

Expected behavior

Copy&Paste work on all localizations

Context

No response

Your environment

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

Search keywords: copy paste copy&paste keyboard cell cells x-data-grid-premium

michelengelen commented 4 weeks ago

Thanks for raising this and your PR. We appreciate it when the community is actionable! 🙇🏼

I left comments on the PR, but will leave it to the team to approve! 👍🏼

oliviertassinari commented 3 weeks ago

What OS are you using? What are the properties values of event when you press the copy shortcut?

rotembarsela commented 3 weeks ago

What OS are you using? What are the properties values of event when you press the copy shortcut?

Checks has been done on the code before changes: image

Tested that on Windows 11 and 10, Keyboard layout: ENG/עבר, Screenshot: (First is CTRL+C on ENG layout, second CTRL+C on HEB layout), you can see that on the second attempt it is false instead of true, because it check the C key value, which is 'ב' on HEB layout image

Example of an HEB Layout keyboard: image