Skip to content

fix(app): a narrow window offers no splits and follows the keyboard - #232

Merged
bketelsen merged 2 commits into
mainfrom
irulan/narrow-splits-keyboard
Nov 13, 2026
Merged

bketelsen merged 2 commits into
mainfrom
irulan/narrow-splits-keyboard

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #228. Fixes #229. Both follow docs/specs/ui.md, Narrow windows.

  • web app: a narrow window offers Split right and Split down #228, splits: a narrow window draws only the active group's active tab, so the split commands do not apply. workspace:split-vertical and workspace:split-horizontal get an applies that is false while the narrow query matches (isNarrow() in app/src/app/narrow.ts), so the palette leaves them out and their keys do nothing. More options and a tab's menu leave out Split right and Split down. An empty tab in a narrow window has no More options, because it would list nothing.
  • web app: a narrow window follows the editor's focus, not the on-screen keyboard #229, the bottom bar: it hides while any text field has the focus (useTextFocus in app/src/app/keyboard.ts), which is what opens the on-screen keyboard: an editor, the inline title, a property, a search field. The editing toolbar still shows only for an editor; an input that an editor draws (the inline title in editing view, a property) is a field, not the editor. A MutationObserver catches a focused field that leaves the document without a focusout (a prompt that closes).
  • web app: a narrow window follows the editor's focus, not the on-screen keyboard #229, prompts: lodge-ui's Prompt takes 100dvh in a narrow window, which iOS Safari does not shrink for the keyboard. usePromptsEndAtKeyboard caps each open prompt (a modal dialog led by its combobox) at calc(100dvh - <inset>px), the inset from the visual viewport (useKeyboardInset, as the editing toolbar uses). The fix stays in notes, so no lodge-ui release is needed.
  • The spec names the keyboard signal (the focus of a text field) and the design doc records the 3 rules.

The iPhone Safari check (#230) is not part of this PR.

Risk tier

Risk tier: 2 — a behaviour change in the web app's narrow layout. No path in .github/risk-paths.json matches.

Docs housekeeping

  • Cross-links hold: docs/specs/ui.md#narrow-windows and docs/design/app.md (Narrow windows) are updated in place; no new doc.

Verification

  • make check green (host)
  • make ui-check green (nsl): 95 files, 814 tests
  • Revert test: in a scratch worktree at the PR head with the 8 non-test files restored to main, make ui-vitest F=src/app/narrow.test.tsx fails 3 tests:
    • the split commands > in a narrow window: expected true to be false (Split right offered)
    • a narrow window > ends a prompt at the on-screen keyboard: expected '' to be 'calc(100dvh - 344px)'
    • a narrow window > hides the bottom bar while a text field outside the editor has the focus: the waitFor on the bottom bar's absence times out (the bar stays drawn)

Cross-review

  • Reviewer openai/gpt-6.1-sol, coder anthropic/claude-opus-5-5.
  • Initial review at beca68e (base c3194a7): Not ready, 2 medium blocking findings, both accepted and fixed in b2485eb:
    1. A narrow prompt's height did not leave out its top margin (the top safe area), so it could still run under the keyboard. Now calc(100dvh - env(safe-area-inset-top, 0px) - <inset>px).
    2. More options or a tab's menu opened in a wide window could still split after the window turned narrow. The menu handlers now check the width when they run, and MainWindow closes an open menu when the window crosses the narrow width.
  • Guard: the tests a menu opened in a wide window > splits nothing once the window is narrow and > closes when the window turns narrow, and the changed prompt test; record .memory/corrections/2026-11-13-pr-232-narrow-menu-and-prompt-height.json.
  • Revert test of the fixes: in a scratch worktree at b2485eb with menus.ts, MainWindow.tsx and keyboard.ts restored to beca68e, make ui-vitest F=src/app/narrow.test.tsx fails those 3 tests on assertions.
  • After the fixes: make ui-check green (95 files, 816 tests), make check green.

A narrow window draws only the active group's active tab
(docs/specs/ui.md#narrow-windows), so the split commands do not apply
there: Split right and Split down leave More options, a tab's menu and
the command palette, and their keys do nothing. An empty tab has no More
options, which would list nothing.

The bottom bar hides while any text field has the focus, which is what
opens the on-screen keyboard, not only while an editor has it; the
editing toolbar still shows only for an editor. Prompts end at the
keyboard: lodge-ui's Prompt takes 100dvh in a narrow window, which iOS
Safari does not shrink for the keyboard, so the app caps it by the
visual viewport's inset.

Fixes #228
Fixes #229
@github-actions github-actions Bot added the level:L3 Skim label Nov 13, 2026
…e out the top safe area

A width rule holds when the action runs: More options and a tab's menu
check the width again before they split, and an open menu closes when the
window crosses the narrow width. A narrow prompt starts under the top
safe area, so its height to the keyboard leaves that margin out too.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
@bketelsen
bketelsen merged commit 9794616 into main Nov 13, 2026
12 checks passed
@bketelsen
bketelsen deleted the irulan/narrow-splits-keyboard branch November 13, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L3 Skim ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web app: a narrow window follows the editor's focus, not the on-screen keyboard web app: a narrow window offers Split right and Split down

2 participants