MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / isKeypressCommand

Function isKeypressCommand

examples/simple/react.js:179–183  ·  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

177 * (cut, copy, select-all, etc.) even though no character is inserted.
178 */
179function isKeypressCommand(nativeEvent) {
180 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
181 // ctrlKey && altKey is equivalent to AltGr, and is not a command.
182 !(nativeEvent.ctrlKey && nativeEvent.altKey);
183}
184
185/**
186 * Translate native top level events into event types.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected