Closed vuduy97 closed 1 year ago
We need to update the regex that detect printable characters to include Japanese characters as well.
We have a similar issue #2338 but for the stop editing.
ππΌ
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
https://user-images.githubusercontent.com/3165635/178031193-ac37a8b8-a995-4eb0-a3ee-b12f5238b72b.mov
I feel that #5414 is only a simplification, but not a bug fix.
new: https://codesandbox.io/s/basiceditinggrid-demo-mui-x-forked-6zfv1e old:https://codesandbox.io/s/datagriddemo-demo-mui-x-forked-tg3qp6
hello @oliviertassinari
I see [data grid] Broken "start editing" integration with Japanese
still happens in both new and old codesandbox urls you had.
https://github.com/mui/mui-x/assets/11783802/e9f7c05d-124e-4fe2-8244-dd16123a2669
I'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
https://user-images.githubusercontent.com/72425044/165739433-82a47833-cb41-4960-afbd-31bcdcefb93f.mp4
Expected behavior π€
I would like to be able to get the first value which is the one using the keyboard type i use
https://user-images.githubusercontent.com/72425044/165739663-25463ae0-5824-48b5-b10c-cfc21bada40f.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