> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Event reference

Every event [`fireEvent`](/api/testing-library/fire-event.md#fireeventelement-event) has a method for, and the template binding each one runs.

```typescript
fireEvent.tap(element); // runs (bindtap) or (catchtap), then the ancestors'
fireEvent.input(element, { detail: { value: 'hello' } }); // $event.detail.value
```

Each method takes the element and an optional `init` object. It runs the element's `(bind*)` or `(catch*)` handler. Touch, mouse and key events then go up to the page, as on a device, until a `(catch*)` handler or a handler that calls `$event.stopPropagation()` stops them. The other events stay on the element, as do `mouseenter` and `mouseleave`.

As on a device, every `(global-bind*)` handler for the event runs first, wherever it is in the page. They're how [`document:` and `window:` listeners](/api/angular-lynx/element-events.md#document-window-and-body-listeners) hear touches, so those run too, after the elements' handlers. One that a `(catch*)` handler stopped reaches them on the next timer:

```typescript
fireEvent.tap(menuItem); // a (catchtap)
await waitForUpdate(); // the component's (document:click) has run
```

`$event.target` is the element, as a device names it: `{ uid }`, its unique id.

## Touch

| Method                  | Binding             |
| ----------------------- | ------------------- |
| `fireEvent.tap`         | `(bindtap)`         |
| `fireEvent.longpress`   | `(bindlongpress)`   |
| `fireEvent.longtap`     | `(bindlongtap)`     |
| `fireEvent.touchstart`  | `(bindtouchstart)`  |
| `fireEvent.touchmove`   | `(bindtouchmove)`   |
| `fireEvent.touchend`    | `(bindtouchend)`    |
| `fireEvent.touchcancel` | `(bindtouchcancel)` |

## Mouse and keyboard

| Method                     | Binding                |
| -------------------------- | ---------------------- |
| `fireEvent.mousedown`      | `(bindmousedown)`      |
| `fireEvent.mouseup`        | `(bindmouseup)`        |
| `fireEvent.mousemove`      | `(bindmousemove)`      |
| `fireEvent.mouseclick`     | `(bindmouseclick)`     |
| `fireEvent.mousedblclick`  | `(bindmousedblclick)`  |
| `fireEvent.mouselongpress` | `(bindmouselongpress)` |
| `fireEvent.wheel`          | `(bindwheel)`          |
| `fireEvent.mouseenter`     | `(bindmouseenter)`     |
| `fireEvent.mouseleave`     | `(bindmouseleave)`     |
| `fireEvent.keydown`        | `(bindkeydown)`        |
| `fireEvent.keyup`          | `(bindkeyup)`          |

## Scrolling

| Method                          | Binding                     |
| ------------------------------- | --------------------------- |
| `fireEvent.scroll`              | `(bindscroll)`              |
| `fireEvent.scrollend`           | `(bindscrollend)`           |
| `fireEvent.scrolltoupper`       | `(bindscrolltoupper)`       |
| `fireEvent.scrolltolower`       | `(bindscrolltolower)`       |
| `fireEvent.scrolltoupperedge`   | `(bindscrolltoupperedge)`   |
| `fireEvent.scrolltoloweredge`   | `(bindscrolltoloweredge)`   |
| `fireEvent.scrolltonormalstate` | `(bindscrolltonormalstate)` |
| `fireEvent.contentsizechanged`  | `(bindcontentsizechanged)`  |

## Coming into view

| Method                  | Binding             |
| ----------------------- | ------------------- |
| `fireEvent.uiappear`    | `(binduiappear)`    |
| `fireEvent.uidisappear` | `(binduidisappear)` |

A device sends `uiappear` when an element comes into view, and `uidisappear` when it leaves. The [`lynxExposure` directive](/guide/exposure.md) and `IntersectionObserver` listen for them, so firing one is how a test scrolls an element into view. An `IntersectionObserver` given a `threshold`, `rootMargin`, `scrollMargin` or `root` sees all of the element come in (an `intersectionRatio` of 1) and all of it leave, as there's no layout to measure in a test:

```typescript
fireEvent.uiappear(frame);
await waitForUpdate();
```

## Forms and focus

| Method                           | Binding                      |
| -------------------------------- | ---------------------------- |
| `fireEvent.input`                | `(bindinput)`                |
| `fireEvent.confirm`              | `(bindconfirm)`              |
| `fireEvent.focus`                | `(bindfocus)`                |
| `fireEvent.blur`                 | `(bindblur)`                 |
| `fireEvent.keyboardheightchange` | `(bindkeyboardheightchange)` |

A focused `<input>` or `<textarea>` fires `keyboardheightchange` as the keyboard shows, changes size and hides. Pass its height as `detail.height`, and `0` for a keyboard that went away:

```typescript
fireEvent.keyboardheightchange(field, { detail: { height: 336 } });
await waitForUpdate();
```

## Accessibility

| Method                          | Binding                     |
| ------------------------------- | --------------------------- |
| `fireEvent.accessibilityaction` | `(bindaccessibilityaction)` |

A screen reader user picking one of an element's `accessibility-actions` fires `accessibilityaction`, with the action's name in `detail.name`:

```typescript
fireEvent.accessibilityaction(row, { detail: { name: 'Delete' } });
```

## Overlays

| Method                   | Binding              |
| ------------------------ | -------------------- |
| `fireEvent.requestclose` | `(bindrequestclose)` |

Android's back button fires `requestclose` at an open `<overlay>`, which has no detail.

## Layout and loading

| Method                   | Binding              |
| ------------------------ | -------------------- |
| `fireEvent.layoutchange` | `(bindlayoutchange)` |
| `fireEvent.load`         | `(bindload)`         |
| `fireEvent.error`        | `(binderror)`        |
| `fireEvent.bgload`       | `(bindbgload)`       |
| `fireEvent.bgerror`      | `(bindbgerror)`      |

An `<image>`, `<svg>`, `<frame>` or `<webview>` fires `load` once its content arrives, and an `<image>`, `<video>`, `<webview>` or `<overlay>` fires `error` when it fails. Pass what the element would report as `detail`, such as an image's size:

```typescript
fireEvent.load(image, { detail: { width: 240, height: 340 } });
await waitForUpdate();
```

## Animations and transitions

| Method                       | Binding                  |
| ---------------------------- | ------------------------ |
| `fireEvent.transitionstart`  | `(bindtransitionstart)`  |
| `fireEvent.transitionend`    | `(bindtransitionend)`    |
| `fireEvent.transitioncancel` | `(bindtransitioncancel)` |
| `fireEvent.animationend`     | `(bindanimationend)`     |

## Other events

For an event without a method, create it yourself. Its type is the binding's event type and the event name, joined by a colon:

```typescript
fireEvent(element, new Event('bindEvent:change')); // runs (bindchange)
```

A `CustomEvent`'s `detail` reaches the handler as `$event.detail`. A `<viewpager>` that moved to its third page:

```typescript
fireEvent(
  pager,
  new CustomEvent('bindEvent:change', {
    detail: { index: 2, isDragged: true },
  }),
);
```

## Related

- [`@blotch/angular-lynx-testing-library`](/api/testing-library/index.md)
- [Testing patterns](/guide/testing/patterns.md)
- [Handling taps and events](/guide/elements/event-handling.md)
