jsx-eslint / eslint-plugin-jsx-a11y

Static AST checker for a11y rules on JSX elements.
MIT License
3.38k stars 637 forks source link

jsx-a11y/control-has-associated-label throws an error on table elements #959

Open elianarlivingston opened 10 months ago

elianarlivingston commented 10 months ago

Hello! I'm experiencing an issue with lint on the 'td' or 'th' elements. Is it correct that this error is being generated? Thank you in advance!

Captura de pantalla 2023-11-03 a la(s) 03 52 41
christopher-william commented 10 months ago

I have the same problem, with this version 6.8

AlanGreene commented 10 months ago

I've just run into the same issue updating to 6.8.0.

From a quick review of the changelog and recent history it looks like an intentional change, or at the very least a side effect of an intentional change: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/919

In my case it's triggered by an empty <td> used in a skeleton loading state.

ZeeshanTamboli commented 10 months ago

Same issue for us in Material UI - https://github.com/mui/material-ui/pull/39752.

EKarpinsky commented 8 months ago

Hi, is there any update on this?

jessebeach commented 7 months ago

Can I call you later?Sent from my Apple WatchOn Jan 8, 2024, at 12:42, EKarpinsky @.***> wrote: Hi, is there any update on this?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were assigned.Message ID: @.***>

frantic1048 commented 2 months ago

We are sticking to the older 6.7.1 version to avoid this issue.

Versions 6.8 and the recent 6.9 still encounter this issue.

ljharb commented 2 months ago

@elianarlivingston @christopher-william @frantic1048 can you provide some code that reproduces the issue?

frantic1048 commented 2 months ago

Here's reproduction repo: https://github.com/frantic1048/eslint-plugin-jsx-a11y-issue-959

It appears that this issue is related to the case where a <th> element has only one self-closing child tag.

ZeeshanTamboli commented 3 weeks ago

Shouldn't th and td be added to ignoreElements in the rule here since they are non-interactive? Would that fix the issue?

ljharb commented 2 weeks ago

I suppose that'd be one solution.