Siteimprove / alfa

:wheelchair: Suite of open and standards-based tools for performing reliable accessibility conformance testing at scale
MIT License
108 stars 12 forks source link

SIA-R81 is too restrictive in its definition of context #767

Open Jym77 opened 3 years ago

Jym77 commented 3 years ago
<div>Lorem ipsum <a href="lorem">Read more</a></div>
<div>Dolor sit amet<a href="dolor">Read more</a></div>

The <div> are ignored in the context (https://github.com/Siteimprove/alfa/blob/main/packages/alfa-rules/src/sia-r81/rule.ts#L134-L162) and therefore we incorrectly flag these links.

Proposed fix: consider any element with text node children as part of the context. This should remove the "structural" <div> but keep the meaningful ones. Might need a bit more tweak to avoid

<div>Lorem ipsum <a href="lorem">Read more</a></div>
<div>Lorem <span>ipsum</span> <a href="ipsum">Read more</a></div>

being two contexts because of the <span>.

kasperisager commented 3 years ago

R81 uses the same definition of "programmatically determined link context" as the associated ACT-R rule: https://act-rules.github.io/rules/5effbb#programmatically-determined-link-context

Jym77 commented 3 years ago

https://github.com/act-rules/act-rules.github.io/issues/1572

kasperisager commented 3 years ago

Putting this on the backlog until we have a resolution to https://github.com/act-rules/act-rules.github.io/issues/1572.

Jym77 commented 2 years ago

Since the ACT rule seems at risk, we're parking this for now.