Skip to content

Conversation

@nami8824
Copy link

Closes: #3177

@nami8824 nami8824 requested a review from a team as a code owner December 30, 2025 16:57
@CLAassistant
Copy link

CLAassistant commented Dec 30, 2025

CLA assistant check
All committers have signed the CLA.

Update allowedAttr function to check element type and return only aria-hidden
for br and wbr elements, as these elements should not accept other ARIA
attributes per ARIA specification.
@nami8824 nami8824 force-pushed the fix/restrict-br-wbr-aria-attrs branch from b181510 to 76c9db8 Compare December 30, 2025 17:07
Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nami8824 Thank you very much for this contribution! It is greatly appreciated.

const invalid = [];
const role = getRole(virtualNode);
let allowed = allowedAttr(role);
let allowed = allowedAttr(role, { vNode: virtualNode });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit reluctant about doing it this way for two reasons.

  1. I think this is mixing node constraints with role constraints. I don't think this function should give both the allowed attributes based on roles, and the allowed attrs based on node names. I think we should probably have a separate method for something like this.

  2. I think we should have role restrictions like this available on the standards object, so that it is configurable and findable, instead of having an inline exception for this case.

The way you've implemented this will ignore the role. I don't think that's the right thing to do here. A <br> with role=heading should allow all ARIA properties allowed on headings. Axe has a separate rule that reports using role=heading on br's as an issue. That way we keep the issues more clearly separated.

I appreciate this is going to make this work a little more complicated. @straker would you mind weighing in here too? I think it might be good to maybe propose a structure for the standards object before asking for more changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARIA in HTML allowances changes for br and wbr

3 participants