diff --git a/packages/media-editor/src/components/media-editor-keyboard-shortcuts-modal/index.tsx b/packages/media-editor/src/components/media-editor-keyboard-shortcuts-modal/index.tsx index 0309a599734789..df555efc3adff9 100644 --- a/packages/media-editor/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +++ b/packages/media-editor/src/components/media-editor-keyboard-shortcuts-modal/index.tsx @@ -57,6 +57,10 @@ const SHORTCUTS: ShortcutEntry[] = [ description: __( 'Rotate 90° clockwise' ), keyCombination: { character: 'R' }, }, + { + description: __( 'Rotate 90° counter-clockwise' ), + keyCombination: { modifier: 'shift', character: 'R' }, + }, { description: __( 'Flip horizontal' ), keyCombination: { character: 'H' }, diff --git a/packages/media-editor/src/image-editor/core/interaction-controller.ts b/packages/media-editor/src/image-editor/core/interaction-controller.ts index 8fd7d73d9c80fd..d9cc5c9658272b 100644 --- a/packages/media-editor/src/image-editor/core/interaction-controller.ts +++ b/packages/media-editor/src/image-editor/core/interaction-controller.ts @@ -896,11 +896,11 @@ export class InteractionController { } case 'r': case 'R': { - if ( e.metaKey || e.ctrlKey || e.altKey || e.shiftKey ) { + if ( e.metaKey || e.ctrlKey || e.altKey ) { break; } e.preventDefault(); - this.options.actions.snapRotate90( 1 ); + this.options.actions.snapRotate90( e.shiftKey ? -1 : 1 ); break; } case 'h': diff --git a/packages/media-editor/src/image-editor/core/test/interaction-controller.ts b/packages/media-editor/src/image-editor/core/test/interaction-controller.ts index 301903e8b5257a..c2cad947d9185f 100644 --- a/packages/media-editor/src/image-editor/core/test/interaction-controller.ts +++ b/packages/media-editor/src/image-editor/core/test/interaction-controller.ts @@ -612,7 +612,18 @@ describe( 'InteractionController', () => { expect( actionMocks.snapRotate90 ).toHaveBeenCalledWith( 1 ); } ); - it.each( [ 'metaKey', 'ctrlKey', 'altKey', 'shiftKey' ] )( + it( 'calls snapRotate90 counter-clockwise on shift+r', () => { + const state = makeState( { rotation: 0 } ); + const { controller } = createController( state ); + + controller.handleKeyDown( + createKeyboardEvent( 'r', { shiftKey: true } ) + ); + + expect( actionMocks.snapRotate90 ).toHaveBeenCalledWith( -1 ); + } ); + + it.each( [ 'metaKey', 'ctrlKey', 'altKey' ] )( 'does not rotate when %s is held with r', ( modifier ) => { const state = makeState( { rotation: 0 } );