Skip to content

Commit 1c1497a

Browse files
authored
fix(no-node-access): stop reporting blur() usage (#1031)
Fixes #1030
1 parent 7606622 commit 1c1497a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/rules/no-node-access.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Disallow direct access or manipulation of DOM nodes in favor of Testing Library'
1111
This rule aims to disallow direct access and manipulation of DOM nodes using native HTML properties and methods — including traversal (e.g. `closest`, `lastChild`) as well as direct actions (e.g. `click()`, `select()`). Use Testing Library’s queries and userEvent APIs instead.
1212

1313
> [!NOTE]
14-
> This rule does not report usage of `focus()`, because imperative focus (e.g. `getByText('focus me').focus()`) is recommended over `fireEvent.focus()`.
14+
> This rule does not report usage of `focus()` or `blur()`, because imperative usage (e.g. `getByText('focus me').focus()` or .`blur()`) is recommended over `fireEvent.focus()` or `fireEvent.blur()`.
1515
> If an element is not focusable, related assertions will fail, leading to more robust tests. See [Testing Library Events Guide](https://testing-library.com/docs/guide-events/) for more details.
1616
1717
Examples of **incorrect** code for this rule:

lib/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const METHODS_RETURNING_NODES = [
114114
'querySelectorAll',
115115
] as const;
116116

117-
const EVENT_HANDLER_METHODS = ['click', 'blur', 'select', 'submit'] as const;
117+
const EVENT_HANDLER_METHODS = ['click', 'select', 'submit'] as const;
118118

119119
const ALL_RETURNING_NODES = [
120120
...PROPERTIES_RETURNING_NODES,

0 commit comments

Comments
 (0)