Skip to content

no-node-access shouldn't report focus() usage #1027

Closed
@Belco90

Description

@Belco90

Have you read the Troubleshooting section?

Yes

Plugin version

v7.5.1

ESLint version

n/a

Node.js version

n/a

Bug description

As discussed in #1026, the focus() method of an HTML node shouldn't be reported, as it's recommended by Testing Library.

Steps to reproduce

import { screen, fireEvent } from '@testing-library/react'
test('should not report focus method', () => {
	screen.getByText('click me').focus();
	// this shouldn't be reported ---^
	fireEvent.keyDown(document.activeElement || document.body);
})

Error output/screenshots

No response

ESLint configuration

N/A

Rule(s) affected

no-node-access

Anything else?

Originated in #1026

Do you want to submit a pull request to fix this bug?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions