-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Broken "start editing" integration with Japanese #4687
Comments
We need to update the regex that detect printable characters to include Japanese characters as well. mui-x/packages/grid/x-data-grid/src/utils/keyboardUtils.ts Lines 16 to 17 in 90c3988
|
We have a similar issue #2338 but for the stop editing. |
This comment was marked as resolved.
This comment was marked as resolved.
Would this work? diff --git a/packages/grid/x-data-grid/src/utils/keyboardUtils.ts b/packages/grid/x-data-grid/src/utils/keyboardUtils.ts
index 7191c6c0..e8642cd7 100644
--- a/packages/grid/x-data-grid/src/utils/keyboardUtils.ts
+++ b/packages/grid/x-data-grid/src/utils/keyboardUtils.ts
@@ -13,9 +13,6 @@ export const isHomeOrEndKeys = (key: string): boolean => key === 'Home' || key =
export const isPageKeys = (key: string): boolean => key.indexOf('Page') === 0;
export const isDeleteKeys = (key: string) => key === 'Delete' || key === 'Backspace';
-const printableCharRegex = /^(\p{L}|\p{M}\p{L}|\p{M}|\p{N}|\p{Z}|\p{S}|\p{P})$/iu;
-export const isPrintableKey = (key: string) => printableCharRegex.test(key);
-
export const GRID_MULTIPLE_SELECTION_KEYS = ['Meta', 'Control', 'Shift'];
export const GRID_CELL_EXIT_EDIT_MODE_KEYS = ['Enter', 'Escape', 'Tab'];
export const GRID_CELL_EDIT_COMMIT_KEYS = ['Enter', 'Tab'];
@@ -23,8 +20,10 @@ export const GRID_CELL_EDIT_COMMIT_KEYS = ['Enter', 'Tab'];
export const isMultipleKey = (key: string): boolean =>
GRID_MULTIPLE_SELECTION_KEYS.indexOf(key) > -1;
+// Non printable keys have a name, e.g. "ArrowRight", see the whole list:
+// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
export const isCellEnterEditModeKeys = (key: string): boolean =>
- isEnterKey(key) || isDeleteKeys(key) || isPrintableKey(key);
+ isEnterKey(key) || isDeleteKeys(key) || key.length === 1;
export const isCellExitEditModeKeys = (key: string): boolean =>
GRID_CELL_EXIT_EDIT_MODE_KEYS.indexOf(key) > -1; |
Has anyone been able to reproduce this issue? cc @m4theushw @mnajdova @vuduy97. I couldn't. The issue was opened saying it reproduces with @mui/x-data-grid: 5.9.0, but with the old edit API and the old one, it works for me Screen.Recording.2022-07-08.at.18.17.35.movI feel that #5414 is only a simplification, but not a bug fix. |
new: https://codesandbox.io/s/basiceditinggrid-demo-mui-x-forked-6zfv1e hello @oliviertassinari I see 2023-06-05.20.29.08.movI'm using Google Japanese Input source(https://www.google.co.jp/ime/) |
Duplicates
Latest version
Current behavior 😯
I create a table that allows to edit cells but have problem entering values, if you don't enter edit mode before entering text but only focus on the cell you want to edit and enter values too, i have problem using keyboard japanese, the first value doesn't get the value of the language I use, it only accepts the value of the keyboard that I press
error.mp4
Expected behavior 🤔
I would like to be able to get the first value which is the one using the keyboard type i use
success.mp4
Steps to reproduce 🕹
Steps:
1.focus the cell you want edit (not enter the edit mode in this cell)
2.change the keyboard in use to Japanese
3.enter input value (like ああああああ)
Context 🔦
I get the value of aああああ, instead of あああああ
Your environment 🌎
@mui/x-data-grid: v5.9.0
Order ID 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: