Skip to content

Commit

Permalink
[DataGrid] Fix broken "start editing" integration with Japanese (#5414)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored Jul 7, 2022
1 parent 5bc3005 commit ffd1940
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/grid/x-data-grid/src/utils/keyboardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ 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);
// 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 isPrintableKey = (key: string) => key.length === 1;

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

0 comments on commit ffd1940

Please sign in to comment.