Repository navigation
Conversation
The shared drawer (#txDrawer) was marked as a modal dialog but didn't act like one: Tab left it, the page behind could take focus, it opened on × instead of the first field, and focus was lost after Save re-rendered the screen. openDrawer() now makes every other child of <body> inert (the scrim stays live), closes any open app bar popup and focuses the first field (× when there is none). A keydown handler wraps Tab and Shift+Tab inside it. closeDrawer() lifts inert and returns focus to the opener, or to its re-rendered copy (id or data-* attributes). Version bumped in CHANGELOG, index.html, README, views-settings.js and CLAUDE.md §1; CLAUDE.md §9 describes the drawer's modal behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
…-drawer-focus Carries master's v1.10.3-v1.10.5 up the stack: declined answers (#14), literal single "~" (#15) and the Import Logs race fix (#18), with clarity-insights' port of #14 to the rebuilt AI tab. One conflict: CLAUDE.md's "Last updated" line. Kept this branch's line and added the v1.10.3-v1.10.5 history. The CHANGELOG merged cleanly. Versions stay 1.16.14. renderImportLog() keeps #18's guards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
…) into fix-drawer-focus Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBUZo6LRYpLthSp2PRi # Conflicts: # js/views-settings.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The shared edit drawer (
#txDrawer) now behaves as a modal dialog. Focus moves onto its first field when it opens. Tab and Shift+Tab cycle inside it, and the page behind it can't be focused or clicked. Escape closes it, and focus goes back to the control that opened it, also after Save re-renders the screen. It looks the same as before.Every edit form uses this one drawer, so all of them are fixed:
showTxDrawer())showTransferDrawer())showBillForm(i)). Add bill (showBillForm(-1)) uses it too, but no button calls it in v1.16.0: + Add bill opens an inline form.editBudget())editBucket()). + New bucket is an inline form, not the drawer.editDebt())No other screen opens a drawer. I checked every
openDrawer()caller.masterhas the same problem, and more. Checked in a browser onorigin/master(v1.10.4):role,aria-modalor label.Escape does close it.
Cause
index.htmlgave the drawerrole="dialog",aria-modal="true"andaria-labelledby="drawerTitle", but nothing in the code made it act like one:<body>.setTimeout, not to the first field.closeDrawer(). That replaced the button focus had just been returned to, so focus ended up on<body>.Mouse clicks were already blocked: the drawer's scrim (z-index 49) covers the app bar (40) and the page.
What changed
All in
js/ui.js. No markup, CSS or caller changed.openDrawer():<body>inert: the app bar, the menu scrim,<main>, the footer and the hidden file inputs. It skips the drawer, its scrim (clicking it still closes the drawer) and<script>tags.closeAppBarPopups()).input,selectortextareathat's visible, enabled and not read-only), or × when there is none.keydownhandler moves focus from the last control to × and back. If focus is outside the drawer, it moves focus to the first control (Tab) or the last (Shift+Tab)._drawerTabbables()lists the controls the browser would stop at: visible, enabled, nottabindex="-1", and one radio per group.closeDrawer():_drawerFocusKey()finds it by its id ordata-*attributes. An opener with neither, like the Transfers row's button, is found by its position inside itstr[data-out][data-in].init.jsalready closed the drawer; it still closes an open app bar menu first), the scrim and ×, the drawer's look, and every form's fields, Save and Delete.CHANGELOG.md, theindex.htmlfooter,README.md(badge and footer line),js/views-settings.jsand CLAUDE.md §1. CLAUDE.md §9 describes the drawer's modal behavior, and the "Last updated" line mentions it.Not verified
Browsers other than headless Chromium, including desktop Edge and Chrome by hand, Firefox and Safari.
inertneeds Chrome/Edge 102+, Firefox 112+ or Safari 15.5+. Without it, Tab still wraps, but the page behind could be focused by script or a screen reader's virtual cursor.Screen readers. The dialog's name was checked through Playwright's accessibility tree, not NVDA, JAWS or VoiceOver.
Escape while a native
<select>list inside the drawer is open. Headless Chromium doesn't show the native list.Phones and touch. Out of scope (desktop only); the existing phone checks in
test-clarity.jsstill pass.Focus after Delete or "Add debt from a card", where the opener may be gone:
Both are better than before, when focus always fell to the page, but neither is a designed destination.
Automated checks: earlier run, not re-run · 9768f6f
Moved unchanged from this PR's "Test results" comment on 2026-11-04; not re-run, so not in the new table format. Originally a description section titled "How it was tested".
Headless Chromium (Playwright) at 1280×900 against
samples/(257 transactions), with the pinned CDN libraries served from npm, on this branch's final commit9768f6f, chained on #36. Each script ran asNODE_PATH=$(npm root -g) node <script> <repo> <outdir>, from one harness shared by every branch in the stack: the base suites, plus every test added by this PR or by a PR below it (cumulative regression).9768f6ftest-clarity.jstest-insights.jstest-finances.jstest-plan.jsboot.jsrace.jsrenderImportLog(the race #18 fixes on master; not in this stack)test-clear-edits.js(from #24)test-rebuild-folder.js(from #25)test-partial-import.js(from #26)test-json-import.js(from #27)test-new-browser-copy.js(from #28)test-json-export.js(from #29)test-plan-links.js(from #30)test-rule-flags.js(from #31, as updated by #32)test-drawer-flags.js(from #32)test-start-balance.js(from #33, as updated by #34)test-ai-summary-period.js(from #34)test-account-names.js(from #35)test-account-order.js(from #36)test-drawer-focus.js(new in this PR)test-insights.js's "General: version line" check reads the version from theindex.htmlfooter, andtest-plan.js's "Budget: Save adds it" accepts a new budget with or without anid, requiring thebud_+ 10 base-36 format once it has one (v1.16.7: Fix transaction links to budgets, buckets and debts pointing at the wrong item after a delete #30 adds ids). Nothing else in the base suites changed.Measured before the chain
By the agent that wrote the fix, on
8a1cb63(built on70c7125, v1.16.0; then numbered v1.16.10).Headless Chromium (Playwright) at 1280×900 against
samples/. CDNs are served from npm by the harness. All scripts ran asNODE_PATH=$(npm root -g) node <script> <worktree> <outdir>.New:
test-drawer-focus.js. Each of the 13 drawer cases below opens from its real opener with the keyboard: focus the opener, then press Enter. The exception is Add bill, which opens from code because no button calls it.Each case checks:
<main>and the footer are inert, and callingfocus()on each visible control behind it fails;[inert]is left;It also checks:
70c7125)8a1cb63)test-drawer-focus.js(new)test-clarity.jstest-finances.jstest-plan.jstest-insights.js(version check reads the footer)boot.jsrace.jsrenderImportLog(#18)renderImportLog(#18)The 82 failures before are every "first field", "inert / can't take focus", "Tab cycles", "Shift+Tab cycles" and "wraps" check, and "focus back on the opener after Save" (body instead). On top of those: the re-render, drawer-over-drawer and popover-from-code checks.
No existing suite was edited. The existing check "Drawer: Escape closes it and focus returns" in
test-finances.jsstill passes.Looks unchanged: a screenshot of the open Transaction detail drawer, with focus removed, is byte-identical before and after (
drawer-open.png).masterwas checked with a separate probe (probe-master-drawer.js) in a temporary worktree, since removed.How to reproduce the bug
Run this on the base branch,
fix-account-order-after-import(#36). Master has the same problem, and more: its drawer doesn't move focus at all, and Tab leaves it.fix-account-order-after-importinstead offix-drawer-focus. Load Try it with sample data.What goes wrong:
Manual QA steps
Setup
git checkout fix-drawer-focus.index.htmlin Edge. Load data with Try it with sample data (or your usual folder: this PR doesn't change saving).1. Transaction detail opens with the cursor in Description
Expected:
Before this fix: focus went to × instead.
2. Tab and Shift+Tab stay inside the drawer
Expected:
Before this fix: Shift+Tab from × went into the page behind; Tab from Save changes left the page.
3. The page behind is inert
<main class="main">.Expected:
<header class="appbar">,<main>,<footer>and the hidden<input type="file">elements carry aninertattribute.#txDrawerand#drawerScrimdon't.4. Escape and the scrim close it, and focus goes back
inert.Expected:
inertleft once the drawer is closed.5. Save returns focus to the row after the re-render
focus test.Expected:
Before this fix: focus fell to the page (
document.body), so Tab started from the top.Remove the note afterwards if you like (open it, clear Notes, Save changes).
6. Other screens that open Transaction detail
Expected:
7. Transfer detail
Expected:
8. A Plan form: Edit budget, with Save and Delete
Expected:
9. The other Plan drawers
For each, open with the keyboard, check the first field has the cursor, Tab round once, press Escape and check focus is back on the button you used:
Expected:
10. Opening the drawer closes an open popover
Expected:
11. It looks the same
Expected:
Please check before merging
https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code