MCPcopy Create free account
hub / github.com/adobe/react-spectrum / isValidKey

Function isValidKey

packages/react-aria/src/interactions/useFocusVisible.ts:74–84  ·  view source on GitHub ↗

* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus * styles visible.

(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

72 * styles visible.
73 */
74function isValidKey(e: KeyboardEvent) {
75 // Control and Shift keys trigger when navigating back to the tab with keyboard.
76 return !(
77 e.metaKey ||
78 (!isMac() && e.altKey) ||
79 e.ctrlKey ||
80 e.key === 'Control' ||
81 e.key === 'Shift' ||
82 e.key === 'Meta'
83 );
84}
85
86function handleKeyboardEvent(e: KeyboardEvent) {
87 hasEventBeforeFocus = true;

Callers 1

handleKeyboardEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected