# wrHasModifier

> True when Ctrl, Cmd, Alt, Shift or Meta is held during a `KeyboardEvent`.

Source: https://ngwr.dev/reference/utils/wr-has-modifier  
Kind: Util  
Updated in v16  
Optional

## Usage

```angular-ts
import { wrHasModifier } from 'ngwr/utils';

@HostListener('keydown', ['$event']) onKey(e: KeyboardEvent) {
  if (wrHasModifier(e)) return;   // let chords such as Cmd+K through
  if (e.key === 'k') focusSearch();
}
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `wrHasModifier(event)` | True when Ctrl, Cmd, Alt, Shift or Meta is held. Return early on it in single-key shortcuts. | `(e: KeyboardEvent) => boolean` | `—` |

## See also

- [Keyboard](https://ngwr.dev/guides/keyboard) — Bind shortcuts, show them as keycaps, and see which keys each component handles.
- [wrIsPrintableKey](https://ngwr.dev/reference/utils/wr-is-printable-key) — True for a single printable character typed without Ctrl, Cmd or Alt (Shift is allowed).
- [WR_KEYS](https://ngwr.dev/reference/utils/wr-keys) — KeyboardEvent.key constants, the WrKey union of their values, and WR_KEY_LABELS, what each key is called on a keycap.
- [WrHotkey](https://ngwr.dev/reference/services/hotkey) — Register keyboard shortcuts like mod+k, where mod is ⌘ on macOS and Ctrl elsewhere.
- [wrIsComposing](https://ngwr.dev/reference/utils/wr-is-composing) — True while an input method (IME) is composing, so the key belongs to it and not to your handler.
