Repository navigation
Fix workspace dialog accessibility and keyboard focus - #192
Conversation
harshsaver
left a comment
There was a problem hiding this comment.
🤖 Agentbox PR audit: changes requested
What needs to change
Please apply the fix plan above.
n/a
What this PR changes
- What it does: Gives workspace dialogs names that screen readers can identify, using their visible titles. Adds two browser tests and corrects a Windows build-path problem.
- What changes in the product: Nothing visible in ordinary mouse use. Assistive technology can identify dialogs such as “New workspace” and “Revoke connection?”. The browser continues handling keyboard focus and Escape.
- Why it exists: Harsh reported that dialogs had visible titles but could not be found by those names through accessibility tools. Issue #186.
- Why merge (or why not yet): The naming fix is appropriate. Remove the unnecessary second attempt to restore focus, then verify the generated bundle and tests. CI has not executed for this PR: its run is waiting for a maintainer to approve it.
- What to expect after merging: Dialog names become accessible. Merging closes #186 automatically, because the PR body says “Fixes #186”. The focus and announcement gaps described below remain and need their own issues if you want them tracked. This audit does not establish that every keyboard flow in #186 is complete.
Full audit (Claude (fable, xhigh) × Codex (gpt-6-astra, xhigh), 3 turns, commit ddb58e6)
PR audit: #192 — Fix workspace dialog accessibility and keyboard focus
Head: ddb58e6
Sign-off
- Claude (fable, xhigh): ✅ satisfied — I re-verified Codex's corrections against source and accept them; decision, blocker and fix plan are unchanged, and this turn only adds evidence (Firefox and Safari also return focus natively; CI is confirmed waiting for approval).
- Codex (gpt-6-astra, xhigh): ❌ not satisfied — retain the small focus-handling fix, but narrow the blocker’s claims and investigate unexpected test failures instead of automatically merging.
Decision
fix — remove the duplicate focus restoration, regenerate the browser bundle, and require passing checks; the naming and build-path changes are sound.
What changes (plain language)
- What it does: Gives workspace dialogs names that screen readers can identify, using their visible titles. Adds two browser tests and corrects a Windows build-path problem.
- What changes in the product: Nothing visible in ordinary mouse use. Assistive technology can identify dialogs such as “New workspace” and “Revoke connection?”. The browser continues handling keyboard focus and Escape.
- Why it exists: Harsh reported that dialogs had visible titles but could not be found by those names through accessibility tools. Issue #186.
- Why merge (or why not yet): The naming fix is appropriate. Remove the unnecessary second attempt to restore focus, then verify the generated bundle and tests. CI has not executed for this PR: its run is waiting for a maintainer to approve it.
- What to expect after merging: Dialog names become accessible. Merging closes #186 automatically, because the PR body says “Fixes #186”. The focus and announcement gaps described below remain and need their own issues if you want them tracked. This audit does not establish that every keyboard flow in #186 is complete.
Findings
Blocking
web/src/app.js:129andweb/src/app.js:133— remove the duplicate focus restoration.- The PR captures
document.activeElementand callsopener.focus()in the dialog’scloselistener. - Native modal dialogs already record the previously focused element and attempt to restore it without scrolling when they close. Restoration precedes delivery of the
closeevent, including closure through Escape. HTML dialog algorithms. - Chromium independently confirms this in
SetFocusForDialog(),close()andCloseWatcherFiredClose(). ItsScheduleCloseEvent()schedules the later event through the animation-frame event queue. Chromium dialog implementation. - Added in turn 3 — Firefox and Safari do the same. Both store the focused element unconditionally on
showModal()and refocus it with prevent-scroll inclose()when the dialog was modal, before queuing thecloseevent. Removing the PR's copy therefore loses nothing in any engine. GeckoHTMLDialogElement.cpp, WebKitHTMLDialogElement.cpp. - In the existing synchronous opening paths, including New workspace (
app.js:236) and Revoke (app.js:297), both captures occur afteraction()disables the trigger (app.js:41). None of the current dialog-building callbacks intentionally moves focus between the captures; the only other.focus()call in the app is atapp.js:423. The PR does not recover a trigger already blurred beforemodal()runs. - This is a small, ruleset-based blocker: the additional restoration duplicates existing platform functionality without an established requirement. Keeping the native behavior meets the simplest-implementation rule and avoids maintaining a second focus policy.
- Correction to turn 1 (verified in turn 3): a routine scroll regression is not established. Chromium's
Element::Focusreturns early, unconditionally, when the element is already focused. The HTMLfocus()steps do not make scrolling conditional on focus changing, so other engines may differ, but no regression was demonstrated. ChromiumElement::Focus. - Correction to turn 1: the cited
close(); await signedIn()paths atapp.js:285,:547and:569do not explicitly direct focus elsewhere. A delayed callback could override an intervening focus change while its opener remains focusable, but those call sites do not demonstrate that regression. Nor does “queued for an animation frame” guarantee an exact one-frame delay. - Nuance added in turn 3: the delayed callback can run while a newer dialog is already open, in
close(); secretDialog(...)(app.js:294-295) and in the new test's close-then-reopen sequence (spec.js:358-362). It is harmless there only because the opener is inert behind the new modal. This is no regression, but it is a second reason the extra call is better gone. - Remove the capture and the explicit
.focus()call; retain dialog removal in thecloselistener. The proposed change still requires the browser checks below.
- The PR captures
Non-blocking
-
web/src/app.js:126,:128,:130— the accessible-name implementation is correct. Each helper invocation creates a distinct heading ID and connects the dialog to that heading. All dialog flows use the shared helper, directly or throughsecretDialog(). This follows the existing naming pattern atapp.js:159and the issue’s explicit collision requirement. Referencing the visible title througharia-labelledbyis the documented dialog pattern. WAI-ARIA dialog guidance.- Checked in turn 3: the only other dynamic
idin the page is the message card atapp.js:356. Message IDs are server-generated with amsg_prefix (bus/store.go:855), so they cannot collide withmodal-title-N.
- Checked in turn 3: the only other dynamic
-
web/src/app.js:131and:133— centralizing removal in thecloselistener is reasonable. The replacement-key flow closes one dialog and immediately opens another (app.js:294and:295), so the closed dialog can briefly coexist in the DOM with its replacement. Unique IDs handle that case. The stylesheet does not override the browser’s hidden state for closed dialogs (web/src/style.css:2). No caller depends on synchronous removal afterclose()returns. -
web/build.mjs:3and:6— the path conversion is correct; keep it.fileURLToPath()handles Windows drive paths and decodes spaces and non-ASCII characters correctly. Using.pathnamedoes not. This is a justified, small adjacent fix with no new dependency. Windows execution remains unverified; the workspace UI job runs on Ubuntu. Node URL documentation. -
bus/hostedweb/app.js— the committed bundle matches the intended change on static inspection. The complete token-level diff contains the modifiedmodal()and the consistent minifier rename chainJr→Hr→Yr→Xr→Qr→Zr→es→ts→rs→ss→ns→is. No unrelated executable change or new network destination was found. It grows by 96 bytes, retains its file mode, and contains no CRLFs. The embedded HTML and stylesheet match their source files. Byte-exact build reproducibility still requires the build check. -
.github/workflows/ci.yml:158— CI exists but has not executed; its run is waiting for maintainer approval (verified in turn 3).- The GitHub Actions API lists one run for this head SHA: run
42286695093, workflowCI, eventpull_request, head repositorySabyaXSachi/agentintercom,status: completed,conclusion: action_required. The commit has zero check runs. action_requiredon a fork pull request means no job started. This replaces turn 2's “unverified” note and confirms turn 1's explanation.- Approving the run looks safe. The workflow token is read-only (
ci.yml:9-10), and the PR's only executable changes are the one-import edit inweb/build.mjsand Playwright tests against mocked routes. The lockfile is untouched. - The configured workspace job installs dependencies, rebuilds, checks generated assets and runs Playwright (
ci.yml:171through:176). The author reports a successful build and 16 passing tests; there are indeed 14 existing tests and two additions. PR description.
- The GitHub Actions API lists one run for this head SHA: run
-
web/tests/workspace.spec.js:346and:369— useful representative coverage, with limits. The additions check named dialogs, keyboard activation, initial focus, one Tab transition, Escape, Close, focus return and destructive-action confirmation.locator.press()focuses its target before sending the key. Thusspec.js:363and:384verify activation but do not prove that sequential keyboard navigation reaches those controls. Playwrightlocator.press.- The role-based zero-count assertions at
spec.js:359,:364and:380exclude hidden dialogs by default. They establish that the dialog is no longer exposed through that role lookup, not necessarily that its delayed removal listener has run. A DOM locator would be needed to assert actual removal. Playwright role selectors. - The tests cannot distinguish native restoration from the PR’s additional restoration. They remain useful unchanged after its removal.
- Optional follow-ups: navigate to Close using Tab, assert focus after actual dialog removal, and check the names and heading IDs through the replacement-key transition at
spec.js:205.
-
Existing focus gap: dialogs opened after asynchronous form submissions can lose their return target.
form()andaction()disable the submit button during the request (app.js:39through:49). If that button had focus and the browser clears it before the response,modal()cannot recover the original target. Relevant paths areapp.js:267,:271,:305and:557. Submitting from the text field follows a different focus path. The platform test explicitly waits for rendering before checking that a disabled button has lost focus; this supports a timing-dependent gap, not a claim that every request reproduces it. Disabled-control focus test.- Successful actions that call
render()also replace the page’s controls (app.js:236), discarding an opener to which focus may just have returned, without selecting a successor. - These behaviors predate the PR and were not reproduced here. They warrant targeted follow-up and prevent claiming that this change solves all focus-return cases.
- Successful actions that call
-
Existing initial-focus concern: destructive confirmations initially focus their action button. Close is appended last (
app.js:132), while confirmations put the destructive control first (app.js:115,:285,:297,:557). Initial focus therefore favors the destructive action; repeated Enter activation deserves a browser check. Guidance recommends considering the least destructive action for irreversible operations. Workspace deletion already requires typing its name (app.js:563). This is unchanged by the PR. WAI-ARIA initial-focus guidance. -
Existing announcement gap: dialog feedback is placed outside the modal.
#noticeis outside every dialog (web/src/index.html:14), while Copy and error handling write there (app.js:66,:42,:567). Modal background content is inert and excluded from the accessibility tree, so these messages cannot be relied on for announcements while the dialog remains open. The backdrop also dims them visually. Screen-reader behavior was not tested. Inert content and accessibility. -
Merge housekeeping (added in turn 3).
- The PR allows maintainer edits (
maintainerCanModify: true), so the fix commit can go on the contributor's branch. - After the fix, the PR body's line “Improved dialog closing and focus restoration behavior” no longer describes the change. Word the squash message around accessible names, the keyboard tests and the build-path fix.
- The PR allows maintainer edits (
-
Ruleset review: The change remains localized to the existing helper and build script, introduces no package or framework, adds no compatibility layer or migration, and preserves the existing architecture and confirmation flows. The unique counter directly serves an explicit requirement. The only identified implementation simplification required before merge is the duplicate focus restoration.
Fix plan
These steps are for Harsh or trusted CI. No contributor code was executed or modified during this audit.
-
Establish the untouched-head baseline. In
web/, using Node 24 and the locked Playwright browser without aCHROMIUM_PATHoverride, run:npm ci --ignore-scripts npm run build git diff --exit-code -- ../bus/hostedweb npx --no-install playwright install --with-deps chromium npm testRequire a clean generated-asset diff and all 16 tests passing. Record the browser version and any failure.
-
Change only the duplicate focus handling in
web/src/app.js.- Delete
const opener = document.activeElement;at line 129. - Replace the line 133 listener with:
dialog.addEventListener('close', () => dialog.remove());
- Keep the counter, heading ID,
aria-labelledbyand deferred removal. The resulting helper is:let modalCount = 0; function modal(title, build) { const headingId = `modal-title-${++modalCount}`; const dialog = el('dialog', { 'aria-labelledby': headingId }, el('h2', { id: headingId }, title)); const close = () => dialog.close(); dialog.append(build(close), el('div', { class: 'actions end' }, button('Close', close))); dialog.addEventListener('close', () => dialog.remove()); document.body.append(dialog); dialog.showModal(); return dialog; }
- Delete
-
Regenerate
bus/hostedweb/app.js. With the baseline dependencies installed, runnpm run buildinweb/. Review and commit the source change and generated output together. Do not hand-edit the bundle. The repository documents the full regeneration command atdocs/dependencies.md:38. -
Leave
web/build.mjsand the existing tests unchanged. The optional test improvements above are follow-up work, not prerequisites for this two-line simplification. -
Verify the fixed version. Run
npm testinweb/; require all 16 tests to pass, including the focus assertions atspec.js:360,:365and:381. Require the configured CI checks, including generated-asset verification, to pass against the fixed commit. -
Investigate contradictory results before deciding.
- If the original passes but removing the manual restoration causes a focus assertion to fail, stop the handoff and reopen this finding with the browser version and failure trace. Establish what the manual call repairs before deciding whether to retain it or change the implementation.
- If the untouched head fails, investigate the failure before recommending merge.
- Supersedes turn 1’s gate: a failing experiment does not automatically authorize merging the original PR or establish the correct alternative implementation.
Message to the developer
Please apply the fix plan above.
n/a
Questions for Harsh
n/a
Verification
- Independently read the full source and test changes, the surrounding application code and all dialog call sites, the complete browser test file, build script, package configuration, relevant lockfile entries, Playwright configuration, fixture server, HTML/CSS, embedded-asset serving code, workspace CI job, CODEOWNERS and dependency documentation.
- The requested
gh pr view 192 -R october-dev/october-bus --commentsfailed because this installed CLI queried deprecated Projects Classic fields. An explicit-fieldgh pr view --jsonsucceeded: the head matches, the PR is mergeable but blocked, comments and reviews are empty, and no check results are listed. gh issue viewcould not connect. Read issue #186 and its discussion through the GitHub web page, including the complete four-item acceptance checklist.- Read the full diff against
496d0d85b5febec72837971e55867d5aea7fcef2, including every changed token in the generated bundle. Used an inspection-only Python snippet to extract changed spans and compare byte sizes; it did not import or execute repository code. git diff --checkpassed. File modes are unchanged. HTML/CSS comparisons passed. The bundle grew from 149,642 to 149,738 bytes and has no CRLFs.- Independently checked the HTML dialog algorithms, Chromium dialog and focus implementations, disabled-control handling and feature status, relevant web-platform tests, WAI-ARIA dialog guidance, Playwright selector/keyboard documentation and Node path conversion documentation.
- Chromium’s current source marks
AvoidSynchronousBlurOnDisabledAttributeChangestable. This supports the synchronous-opening analysis but does not identify the exact Chromium shipped with the pinned Playwright 1.64.1. The baseline check must establish that behavior. Chromium feature definitions. - Turn 3 re-checks (Claude):
- Re-ran
gh pr view --json: head is stillddb58e6, with no new comments, reviews or checks. - Read
Element::Focusin Chromium'selement.ccverbatim: the already-focused early return exists and is unconditional.CloseWatcherFiredClose()exists and calls the sameclose()that restores focus. - Read Gecko's and WebKit's
HTMLDialogElement.cppverbatim: both store and restore the previously focused element as described in the blocker. Their Escape-key dispatch sites andfocus()internals were not read. - Queried the GitHub Actions API for the head SHA: one run,
action_required, zero check runs. - Confirmed message IDs are server-generated (
bus/store.go:855), thatapp.js:423is the only other.focus()call, and that no dialog CSS overridesdisplay. - Confirmed against the Playwright behaviour Codex cited that the reopened dialog in the new test cannot collide with the just-closed, not-yet-removed one, because role lookups skip hidden dialogs.
- Re-ran
- No installs, builds, tests, repository scripts, browser sessions or screen-reader tests were run, as required for this outside-contributor audit. Static reasoning and upstream tests are not a substitute for executing the project’s checks.
- Checkout remains clean. No files were written and no GitHub mutation was performed. The revised audit is returned here.
Audit log
- Turn 1 (Claude (fable, xhigh)): Audited from scratch. Confirmed the
aria-labelledbyand unique-ID fix against issue #186, verified the committed bundle token by token, and traced all dialog flows and existing tests. Found the PR's manual focus return redundant with native<dialog>(spec, Chromium source, WPT). Decision: fix (remove two lines, rebuild bundle, run suite with a gate). Logged three older accessibility gaps as follow-ups. - Turn 2 (Codex (gpt-6-astra, xhigh)): Independently verified the diff, call sites, tests, bundle and platform behavior. Retained
fix, narrowed the blocking finding’s unsupported scroll/focus-regression claims, corrected CI and test-coverage overstatements, expanded the existing focus-gap notes, and replaced automatic merge-on-test-failure with investigation and re-review. - Turn 3 (Claude (fable, xhigh)): Verified Codex's two new Chromium claims from source and accepted all its corrections, including the investigate-first gate. Disputed only the “unverified” CI note: the Actions API shows the run for this head is
action_required, so turn 1's explanation stands. Added Gecko and WebKit source confirmation of native focus return, the inert-opener nuance, the message-ID collision check and merge housekeeping. Decision, blocker substance and fix plan are unchanged.
Automated review by Harsh's agentbox: two AI reviewers audited this PR against the project ruleset and agreed on it.
Per maintainer review: remove the manual opener.focus() restoration, which duplicates the platform behavior of modal dialogs, and regenerate the committed bundle. Accessible names and keyboard tests are unchanged.
|
Applied the review fix on this branch: removed the manual opener.focus() restoration so dialogs rely on the platform's native focus return, and regenerated the committed bundle with npm run build. Verified the untouched head first (bundle clean, 16/16 Playwright tests pass), then re-ran the suite after the fix (16/16 pass, including the focus assertions), merged current main, and pushed. Ready for re-review. |
Resolved: the audit of 6cef94e found the requested changes in place.
🤖 Agentbox PR audit: ready to mergeWhat this PR changes
Full audit (Claude (fable, xhigh) × Codex (gpt-6-astra, xhigh), 2 turns, commit 6cef94e)PR audit: #192 — Fix workspace dialog accessibility and keyboard focusHead: 6cef94e Sign-off
Decisionmerge — the duplicate focus handling is gone, the remaining change is small and correct, and no blocking finding is left; merge once the waiting CI run is approved and passes. What changes (plain language)
FindingsBlockingNone. The previous blocker is resolved. Commit Chromium’s current implementation records the focused element, attempts to restore it without scrolling when the modal closes, and uses the same close operation for Escape. The application now relies on that behavior. Gecko and WebKit were also inspected in the previous audit. Chromium dialog implementation. Non-blocking
Fix plann/a Message to the developern/a Questions for Harshn/a Verification
Audit log
Final checksNot run here: this PR is from an outside contributor, so its code is never executed on this machine. Rely on CI before merging. Automated review by Harsh's agentbox: two AI reviewers audited this PR against the project ruleset and agreed on it. |
harshsaver
left a comment
There was a problem hiding this comment.
Approved after the Claude x Codex audit agreed it is ready (audited head 6cef94e, current; CI green).
harshsaver
left a comment
There was a problem hiding this comment.
Approved after the Claude×Codex audit agreed it is ready (audited head 6cef94e; this head only adds a merge of main).
harshsaver
left a comment
There was a problem hiding this comment.
Approved after the Claude×Codex audit agreed it is ready (audited head 6cef94e; this head only adds a merge of main).
Summary
Fixes #186 by improving accessibility and keyboard focus behavior for workspace dialogs.
Changes made
modal()helper.aria-labelledby.Additional change
Updated
web/build.mjsto usefileURLToPath()for cross-platform output path handling. This fixes a Windows build issue without changing Linux build output.Testing
npm run buildpassed.npm testpassed.No new dependencies were introduced.