@@ -161,24 +161,28 @@ function Game({
161
161
? keyboardLayoutDesc . horizontalLayout
162
162
: keyboardLayoutDesc . verticalLayout ;
163
163
useKeydown ( ( event ) => {
164
- const { key } = event ;
165
- if ( key === "Escape" ) {
166
- event . preventDefault ( ) ;
167
- onClear ( ) ;
168
- } else if ( key . length === 1 && shortcuts . includes ( key . toLowerCase ( ) ) ) {
169
- event . preventDefault ( ) ;
170
- const index = shortcuts . indexOf ( key . toLowerCase ( ) ) ;
171
- if ( index < board . length ) {
172
- onClick ( board [ index ] ) ;
164
+ const { key, ctrlKey, metaKey } = event ;
165
+ if ( ! ctrlKey && ! metaKey ) {
166
+ if ( key === "Escape" ) {
167
+ event . preventDefault ( ) ;
168
+ onClear ( ) ;
169
+ } else if ( key . length === 1 && shortcuts . includes ( key . toLowerCase ( ) ) ) {
170
+ event . preventDefault ( ) ;
171
+ const index = shortcuts . indexOf ( key . toLowerCase ( ) ) ;
172
+ if ( index < board . length ) {
173
+ onClick ( board [ index ] ) ;
174
+ }
175
+ } else if (
176
+ key . toLowerCase ( ) === keyboardLayoutDesc . orientationChangeKey
177
+ ) {
178
+ event . preventDefault ( ) ;
179
+ if ( volume === "on" ) playLayout ( ) ;
180
+ setCardOrientation ( isHorizontal ? "vertical" : "horizontal" ) ;
181
+ } else if ( key . toLowerCase ( ) === keyboardLayoutDesc . layoutChangeKey ) {
182
+ event . preventDefault ( ) ;
183
+ if ( volume === "on" ) playLayout ( ) ;
184
+ setLayoutOrientation ( isLandscape ? "portrait" : "landscape" ) ;
173
185
}
174
- } else if ( key . toLowerCase ( ) === keyboardLayoutDesc . orientationChangeKey ) {
175
- event . preventDefault ( ) ;
176
- if ( volume === "on" ) playLayout ( ) ;
177
- setCardOrientation ( isHorizontal ? "vertical" : "horizontal" ) ;
178
- } else if ( key . toLowerCase ( ) === keyboardLayoutDesc . layoutChangeKey ) {
179
- event . preventDefault ( ) ;
180
- if ( volume === "on" ) playLayout ( ) ;
181
- setLayoutOrientation ( isLandscape ? "portrait" : "landscape" ) ;
182
186
}
183
187
} ) ;
184
188
0 commit comments