ENG-1743: Test 242 False Negative on A Elements with role=link

Bug (ENG-1743): Access Engine test 242 (links sharing an accessible name should go to the same place) scoped its candidate set to a[href]:not([href=""])[data-ae_ar="null"][data-ae_vis][data-ae_avat][data-ae_an] — anchors with no ARIA role at all. Any role attribute took the anchor out of scope, including role="link", which does not change what the element is. A pair such as

<a href="foo" role="link">Go to the page</a> and <a href="bar" role="link">Go to the page</a>

was silently skipped and the test reported N/A — a false negative.

Impact: A screen reader user pulling up a list of links sees the same name twice with no way to tell the destinations apart. A redundant role="link" on an anchor is poor practice but not a WCAG failure in itself, and it should not stop the element being tested as the link it is.

Test Logic (test 242):

Common Scenarios:

Fix: Match on the computed-role attribute added in ENG-1730 (data-ae_computed_role, the explicit-or-implicit ARIA role) instead of on the absence of a role:

a[href]:not([href=""])[data-ae_computed_role="link"][data-ae_vis][data-ae_avat][data-ae_an]

The selector requires an href, and an A with an href and no other role already has the implicit role link — so this single selector covers everything the old data-ae_ar="null" selector did, plus an explicit role="link" in any letter case. Nothing else in the test changes: grouping by accessible name and the base-URL href resolution are untouched.
N/A — out of scope
PASS — not flagged (correct)
FAIL — flagged (correct; the role=link cases are the ENG-1743 repro, the rest are regression guards)

Note: test 242 compares links across the whole page, so each case below uses its own accessible name. Two cases that happened to share a name would form a group of their own and change each other's outcome.

N/A Tests — Test 242 Does Not Apply

Two anchors with role="button" sharing a name, different hrefs other role

Open the button target Open the button target

These are exposed as buttons, not links, so test 242 does not apply. Only role=link (or no role) is in scope. Should not be flagged.

Two anchors with role="link" sharing a name, hidden with display:none hidden

Test 242 only evaluates elements that are not intentionally hidden: the selector requires [data-ae_vis]. Should not be flagged.

Two anchors with role="link" sharing a name, aria-hidden="true" not exposed

Not available to assistive technologies, so the selector's [data-ae_avat] requirement excludes them. Should not be flagged.

PASS Tests — In Scope, No Violation

Baseline: two role-less anchors sharing a name and an href no role

Open the baseline page Open the baseline page

Same name, same destination — duplication that tells the truth. Should not be flagged.

Two anchors with role="link" sharing a name and an href role=link

Open the shared page Open the shared page

Newly in scope after ENG-1743, and compliant. Should not be flagged.

Two anchors with role="link" with distinct names role=link

Open the first distinct page Open the second distinct page

Different destinations, different names. Should not be flagged.

Two anchors with role="link" sharing a name, one relative and one absolute href for the same page url forms

Open the news section Open the news section

The hrefs resolve to the same URL once the base URL is applied and the trailing slash is ignored (ENG-1729), so the shared name is accurate. Should not be flagged.

FAIL Tests — Correctly Flagged

ENG-1743 repro cases — missed before the fix

Ticket repro: two role="link" anchors sharing a name, different hrefs role=link

Go to the page Go to the page

The markup from ENG-1743: same name, two destinations. Pre-fix: N/A, nothing flagged ❌. Post-fix: both flagged ✓.

A role-less anchor and a role="link" anchor sharing a name, different hrefs mixed

Open the mixed pair target Open the mixed pair target

Pre-fix the role="link" half was invisible, so the remaining link looked unique and neither was reported. Post-fix both are grouped and flagged ✓.

Two uppercase role="LINK" anchors sharing a name, different hrefs case

Open the uppercase role target Open the uppercase role target

ARIA role tokens are case-insensitive and the computed role is normalised to lower case. Pre-fix: not flagged ❌. Post-fix: flagged ✓.

Three role="link" anchors sharing a name, different hrefs group

Open the trio target Open the trio target Open the trio target

Every member of a suspicious group is reported, not just the duplicates after the first. Pre-fix: not flagged ❌. Post-fix: all three flagged ✓.

Regression guard — flagged before and after the fix

Two role-less anchors sharing a name, different hrefs no role

Open the role-less pair target Open the role-less pair target

The original test 242 case: an A with an href and no role already has the implicit role link, so the computed-role selector still covers it. Must stay flagged ✓.

Real-World Scenarios

Card grid with a "Read more" link per card role=link

Antelope prints Read more

Goat photography Read more

The classic case: identical link names, different destinations, no context in the name itself. Pre-fix: not flagged ❌. Post-fix: both flagged ✓.

Table with a per-row "View" link role=link

Orders
OrderDetails
1001View
1002View

Row links named only "View" carry no row context. Pre-fix: not flagged ❌. Post-fix: both flagged ✓.