Skip to content

Suggest label over text #255

@kentcdodds

Description

@kentcdodds

Relevant code or config:

<div
  id="foo-123"
  aria-labelledby="foo-label"
> ... </div>
<label
  id="foo-label"
  for="foo-123"
>Foobar</label>

What you did:

Tried this in the Testing Playground: https://testing-playground.com/?markup=DwEwlgbgBGILwCIBmB7FBaAjAJgMwKgEMAnMQ9AG0ICMBTCi2kagT0VQyrooQD4oAdEKjAA9OAi8AUMC70Y8ZGko16BVMXbKc%2BXgDE01EmLkVeQA&query=M4YwTgphB2B0DmEAuAhAngGQIYCMIBsAVCADyQAoB6AMwHtacsxKBLASiA

What happened:

It recommends screen.getByText even though screen.getByLabelText works and should be preferred... I think.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions