Repository navigation
fix(audit_keyboard): resolve every aria-labelledby id reference - #280
Conversation
aria-labelledby is a list of IDs separated by ASCII whitespace, but the keyboard audit passed the whole attribute to getElementById. A control labelled by more than one element (or with stray whitespace) got no labelledby name and fell back to its title or text content, which also feeds stop fingerprints and skip-link detection. Split the list on ASCII whitespace like upstream Playwright now does (microsoft/playwright#43361), resolve each ID in the element's own tree root, and join the referenced texts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cu5QoT8BnTsfG9oqYzX1TK
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
The focus probe reads document.activeElement, which stops at a shadow host, so references inside shadow roots are never reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cu5QoT8BnTsfG9oqYzX1TK
Upstream change
fix(aria): split id reference lists on ASCII whitespace(commit microsoft/playwright@b536a63)In
roleUtils.ts, upstream used to split ID reference lists withsplit(' '). It now splits them on ASCII whitespace (/[ \t\n\f\r]+/), so tab- and newline-separatedaria-labelledbyandaria-describedbylists resolve. still does not count as a separator.Why it matters here
The upstream fix reaches our snapshots only when we upgrade Playwright. But
audit_keyboardcomputes its own accessible name inside the page (src/tools/auditKeyboard.ts), and that code had a worse version of the same bug: it passed the wholearia-labelledbyvalue todocument.getElementById. Soaria-labelledby="verb noun"resolved to nothing, and the stop fell back to itstitleor text content. That wrong name shows up in the report and the step lines. It also feedsbuildFingerprint(used for loop detection) and skip-link detection.Fix
aria-labelledbyon ASCII whitespace, the same way upstream does, and join the trimmed text of every referenced element that resolves.getRootNode(), the same as upstream. This does not add shadow-DOM support: the probe starts fromdocument.activeElement, which stops at a shadow host, so focus inside a shadow root is still out of scope.aria-label→ labelledby →title→<label>→ text.Tests
tests/tools-auditKeyboard.integration.test.ts: a button witharia-labelledby=" verb\tnoun missing ". It is now namedSave draft. Onmainthe test fails withexpected 'Fallback text' to be 'Save draft'.tests/tools-auditKeyboard*pass, andnpm run lintis clean. I ran the integration tests on the sandbox's Chromium 1194 (PLAYWRIGHT_MCP_EXECUTABLE_PATH,PLAYWRIGHT_MCP_SANDBOX=false).Other upstream MCP commits reviewed since #277 (no action)
browser_resume): this repo has nobrowser_resume.roleUtilsonly, and we get it with the next Playwright bump (tracked in Playwright 1.64.0 stable is out: recorder API removed; run the upgrade gate before bumping #271 / Migrate recorder API and pair Playwright 1.64.0 behind the upgrade gate #272). Our in-page name code does not track name sources.🤖 Generated with Claude Code
https://claude.ai/code/session_01Cu5QoT8BnTsfG9oqYzX1TK