MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / isKeypressCommand

Function isKeypressCommand

code/event-handlers/public/app.js:2528–2532  ·  view source on GitHub ↗

* Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands * (cut, copy, select-all, etc.) even though no character is inserted.

(nativeEvent)

Source from the content-addressed store, hash-verified

2526 * (cut, copy, select-all, etc.) even though no character is inserted.
2527 */
2528function isKeypressCommand(nativeEvent) {
2529 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
2530 // ctrlKey && altKey is equivalent to AltGr, and is not a command.
2531 !(nativeEvent.ctrlKey && nativeEvent.altKey);
2532}
2533
2534/**
2535 * Translate native top level events into event types.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected