isAppShortcutTarget
Whether a keydown is a fair target for an app-level shortcut: nothing has claimed it (`defaultPrevented`), no ctrl/meta/alt modifier is held (those are the browser's and the OS's), and focus is not inside something that types or has its own key handling — input, textarea, select, video, audio, `[contenteditable]`, or an element with (or inside one with) the role listbox, menu, slider, combobox, radiogroup or tablist. `Lightbox` runs every unhandled keydown through this before calling `onKey`, so a consumer's "f to favourite" never fires while the user types a caption. Works with a DOM `KeyboardEvent` or React's wrapper.
packages/ui/src/components/patterns/keyboard.ts
@marktiderman/genesis-ui/patternsimport { isAppShortcutTarget } from "@marktiderman/genesis-ui/patterns";react-docgen-typescript.isAppShortcutTarget
Whether a keydown is a fair target for an app-level shortcut: nothing has claimed it (`defaultPrevented`), no ctrl/meta/alt modifier is held (those are the browser's and the OS's), and focus is not inside something that types or has its own key handling — input, textarea, select, video, audio, `[contenteditable]`, or an element with (or inside one with) the role listbox, menu, slider, combobox, radiogroup or tablist. `Lightbox` runs every unhandled keydown through this before calling `onKey`, so a consumer's "f to favourite" never fires while the user types a caption. Works with a DOM `KeyboardEvent` or React's wrapper.
No declared props.
isAppShortcutTargetElement
Whether `target` (or an ancestor) is a field or widget that owns its own keys. Non-element targets pass. The element half of `isAppShortcutTarget`, for guards on events without modifier keys, such as touch.
No declared props.