dom-accessibility-api
dom-accessibility-api copied to clipboard
A link with div content but no text element returns "" as the name
Possible duplicate of #908 . I believe this is a regression from #893 .
Sample HTML:
<a href="/users/Ram"><div title="Ram"></div></a>
Sandbox: https://codesandbox.io/s/intelligent-khayyam-04l055?file=/src/index.test.js
To see the differing behaviors between 0.5.6 and 0.5.16, change the dom-accessibility-api version from 0.5.16 to 0.5.14 or earlier and do a hard refresh (ctrl+shift+r in firefox).
Working stack (0.5.6):
computeElementTextAlternative(), accessible-name-and-description.ts:531
computeElementTextAlternative(), accessible-name-and-description.ts:597
computeTextAlternative(), accessible-name-and-description.ts:370
childNodes(), accessible-name-and-description.ts:369
computeMiscTextAlternative(), accessible-name-and-description.ts:651
computeTextAlternative(), accessible-name-and-description.ts:682
computeAccessibleName(), accessible-name.ts:40
anonymous(), role.js:150
filter(), role.js:144
allQuery(), query-helpers.js:87
query(), query-helpers.js:130
getAllByRole(), users.test.js:37
Non-working stack (0.5.16):
computeElementTextAlternative(), accessible-name-and-description.ts:552
computeElementTextAlternative(), accessible-name-and-description.ts:626
computeTextAlternative(), accessible-name-and-description.ts:372
forEach(), accessible-name-and-description.ts:371
computeMiscTextAlternative(), accessible-name-and-description.ts:686
computeTextAlternative(), accessible-name-and-description.ts:721
computeAccessibleName(), accessible-name.ts:40
anonymous(), role.js:183
filter(), role.js:178
allQuery(), query-helpers.js:74
query(), query-helpers.js:109
getAllByRole(), users.test.js:54
Explanation:
2F -> get child node titles -> 2D -> fallback (null in 0.5.16, title of node in 0.5.6).
Reading through the spec, so I could be very wrong:
-
<a href="/users/Ram">-> Get name from content (2F) -
<div title="Ram">-> Check inner content; ifnullor empty, then return 2I (thetitle="Ram").