Skip to content

Commit ffd1940

Browse files
authored
[DataGrid] Fix broken "start editing" integration with Japanese (#5414)
1 parent 5bc3005 commit ffd1940

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/grid/x-data-grid/src/utils/keyboardUtils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ export const isHomeOrEndKeys = (key: string): boolean => key === 'Home' || key =
1313
export const isPageKeys = (key: string): boolean => key.indexOf('Page') === 0;
1414
export const isDeleteKeys = (key: string) => key === 'Delete' || key === 'Backspace';
1515

16-
const printableCharRegex = /^(\p{L}|\p{M}\p{L}|\p{M}|\p{N}|\p{Z}|\p{S}|\p{P})$/iu;
17-
export const isPrintableKey = (key: string) => printableCharRegex.test(key);
16+
// Non printable keys have a name, e.g. "ArrowRight", see the whole list:
17+
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
18+
export const isPrintableKey = (key: string) => key.length === 1;
1819

1920
export const GRID_MULTIPLE_SELECTION_KEYS = ['Meta', 'Control', 'Shift'];
2021
export const GRID_CELL_EXIT_EDIT_MODE_KEYS = ['Enter', 'Escape', 'Tab'];

0 commit comments

Comments
 (0)