Skip to content

Commit da47abb

Browse files
author
peterhegman
committed
docs(test-utils): add tip about using trigger('focus')
When using `trigger('focus')` with jsdom v16.4.0 and above you must use `attachTo` when mounting the component.
1 parent 7e78174 commit da47abb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/api/wrapper/trigger.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ test('trigger demo', async () => {
3838
})
3939
```
4040

41+
::: tip
42+
When using `trigger('focus')` with [jsdom v16.4.0](https://github.com/jsdom/jsdom/releases/tag/16.4.0) and above you must use the [attachTo](../options.md#attachto) option when mounting the component. This is because a bug fix in [jsdom v16.4.0](https://github.com/jsdom/jsdom/releases/tag/16.4.0) changed `el.focus()` to do nothing on elements that are disconnected from the DOM.
43+
:::
44+
4145
- **Setting the event target:**
4246

4347
Under the hood, `trigger` creates an `Event` object and dispatches the event on the Wrapper element.

0 commit comments

Comments
 (0)