Skip to content

alt attribute can't be empty #1313

Closed
Closed
@Tasiobg

Description

@Tasiobg

Since this update #1241 the alt attribute for the img role can't be empty.
My understanding is that the alt attribute should be present but in some cases like decorative images it should be empty, some info here

Is this an issue or an intended change?

Works

it(`testcase`, async () => {
    render(
      <div>
        <img src="url" alt="alt text" />
      </div>,
    );

    expect(screen.getByRole('img')).toBeInTheDocument();
  });

Fail

it(`testcase`, async () => {
    render(
      <div>
        <img src="url" alt="" />
      </div>,
    );

    expect(screen.getByRole('img')).toBeInTheDocument();
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions