Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A link with div content but no text element returns "" as the name #920

Open
tsmock opened this issue Mar 30, 2023 · 0 comments
Open

A link with div content but no text element returns "" as the name #920

tsmock opened this issue Mar 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tsmock
Copy link

tsmock commented Mar 30, 2023

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; if null or empty, then return 2I (the title="Ram").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants