diff --git a/packages/x-data-grid-premium/src/hooks/features/clipboard/useGridClipboardImport.ts b/packages/x-data-grid-premium/src/hooks/features/clipboard/useGridClipboardImport.ts index 6506078b20ad..5e66193cd026 100644 --- a/packages/x-data-grid-premium/src/hooks/features/clipboard/useGridClipboardImport.ts +++ b/packages/x-data-grid-premium/src/hooks/features/clipboard/useGridClipboardImport.ts @@ -304,11 +304,13 @@ function defaultPasteResolver({ }); } -const isPasteShortcut = (event: React.KeyboardEvent) => { - if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'v') { - if (event.shiftKey || event.altKey) { - return false; - } +function isPasteShortcut(event: React.KeyboardEvent) { + if ( + (event.ctrlKey || event.metaKey) && + event.key.toLowerCase() === 'v' && + !event.shiftKey && + !event.altKey + ) { return true; } return false; diff --git a/packages/x-data-grid/src/hooks/features/clipboard/useGridClipboard.ts b/packages/x-data-grid/src/hooks/features/clipboard/useGridClipboard.ts index 0acc23c0b2e4..8180196fb05a 100644 --- a/packages/x-data-grid/src/hooks/features/clipboard/useGridClipboard.ts +++ b/packages/x-data-grid/src/hooks/features/clipboard/useGridClipboard.ts @@ -74,7 +74,14 @@ export const useGridClipboard = ( const handleCopy = React.useCallback( (event: KeyboardEvent) => { - if (!((event.ctrlKey || event.metaKey) && event.key === 'c')) { + if ( + !( + (event.ctrlKey || event.metaKey) && + event.key.toLowerCase() === 'c' && + !event.shiftKey && + !event.altKey + ) + ) { return; } diff --git a/packages/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts b/packages/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts index 25c7cfdb5775..2ee3b6e8a8c7 100644 --- a/packages/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts +++ b/packages/x-data-grid/src/hooks/features/editing/useGridCellEditing.ts @@ -171,7 +171,12 @@ export const useGridCellEditing = ( } if (isPrintableKey(event)) { reason = GridCellEditStartReasons.printableKeyDown; - } else if ((event.ctrlKey || event.metaKey) && event.key === 'v') { + } else if ( + (event.ctrlKey || event.metaKey) && + event.key.toLowerCase() === 'v' && + !event.shiftKey && + !event.altKey + ) { reason = GridCellEditStartReasons.pasteKeyDown; } else if (event.key === 'Enter') { reason = GridCellEditStartReasons.enterKeyDown; diff --git a/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts b/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts index 1998dab6c7c5..eac499b990a9 100644 --- a/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts +++ b/packages/x-data-grid/src/hooks/features/editing/useGridRowEditing.ts @@ -246,7 +246,12 @@ export const useGridRowEditing = ( if (isPrintableKey(event)) { reason = GridRowEditStartReasons.printableKeyDown; - } else if ((event.ctrlKey || event.metaKey) && event.key === 'v') { + } else if ( + (event.ctrlKey || event.metaKey) && + event.key.toLowerCase() === 'v' && + !event.shiftKey && + !event.altKey + ) { reason = GridRowEditStartReasons.printableKeyDown; } else if (event.key === 'Enter') { reason = GridRowEditStartReasons.enterKeyDown; diff --git a/packages/x-date-pickers/src/internals/hooks/useField/useField.ts b/packages/x-date-pickers/src/internals/hooks/useField/useField.ts index 740054ce131d..c4d8827ac72b 100644 --- a/packages/x-date-pickers/src/internals/hooks/useField/useField.ts +++ b/packages/x-date-pickers/src/internals/hooks/useField/useField.ts @@ -302,7 +302,10 @@ export const useField = < // eslint-disable-next-line default-case switch (true) { // Select all - case event.key === 'a' && (event.ctrlKey || event.metaKey): { + case (event.ctrlKey || event.metaKey) && + event.key.toLowerCase() === 'a' && + !event.shiftKey && + !event.altKey: { // prevent default to make sure that the next line "select all" while updating // the internal state at the same time. event.preventDefault();