You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
web: a soft hyphen or zero-width space stays in a name, so toHaveAccessibleName fails on a link getByRole found by that name #2491
bugSomething isn't workingneeds:maintainer-decisionWaiting on a maintainer to accept the issue or set the direction. The author has nothing to do yet.webWeb engine (@e2e-dev/web)
getByRole('link', { name: 'Datenschutzerklärung' }) finds <a href="#">Datenschutz­erklärung</a>: Playwright drops U+00AD and U+200B before it matches a name. The tree keeps them, so toHaveAccessibleName('Datenschutzerklärung') on the same locator fails:
locator: getByRole("link", name: "Datenschutzerklärung")
expected: accessible name "Datenschutzerklärung"
observed: name "Datenschutzerklärung" (match count 1)
Soft hyphens are common on German and Dutch sites, and zero-width spaces in CMS text. The agent reads the name with the hidden character too.
npm install in the repo root, then cd invisible-name
npx e2e run
Both tests pass toHaveCount(1) and fail toHaveAccessibleName.
Expected: both pass.
Versions
e2e 0.25.0, @e2e-dev/web 0.17.0, Node 25.2.1, macOS. Also on main at 7c1b2b2.
Engine
@e2e-dev/web
Anything else
Chrome's accessibility tree keeps both characters. The tree already names the way getByRole matches when the two differ (inert text, icon glyphs), so I'd follow Playwright here. I have the fix with a crosscheck fixture and can send the PR.
Automated triage (AI), not yet read by a maintainer.
Confirmed on main 7c1b2b258. Playwright's role matching drops U+200B and U+00AD from a name before it compares. The web tree's name exit, withoutGlyphs in packages/web/src/in-page/read-semantics.ts, only replaced icon glyphs, and core normalizeText only collapses whitespace. So getByRole finds Datenschutz­erklärung by the plain word, while the tree name, and toHaveAccessibleName along with it, keeps the hidden character. This is a real problem on German/Dutch sites and with CMS text, and the agent reads the hidden character too.
#2495 fixes it at that exit, with a crosscheck fixture that fails without the fix. Text matchers (toHaveText) are not part of that PR.
bugSomething isn't workingneeds:maintainer-decisionWaiting on a maintainer to accept the issue or set the direction. The author has nothing to do yet.webWeb engine (@e2e-dev/web)
Activity
okwasniewski commentedon Nov 29, 2026
Confirmed on main
7c1b2b258. Playwright's role matching drops U+200B and U+00AD from a name before it compares. The web tree's name exit,withoutGlyphsinpackages/web/src/in-page/read-semantics.ts, only replaced icon glyphs, and corenormalizeTextonly collapses whitespace. SogetByRolefindsDatenschutz­erklärungby the plain word, while the tree name, andtoHaveAccessibleNamealong with it, keeps the hidden character. This is a real problem on German/Dutch sites and with CMS text, and the agent reads the hidden character too.#2495 fixes it at that exit, with a crosscheck fixture that fails without the fix. Text matchers (
toHaveText) are not part of that PR.