Phone bar: block bar stays, one tap fires, swipe/edge selects, rests above the home indicator (#290) #308

Closed
kayg wants to merge 0 commits from issue/290-bar-stays into dev
Owner

Closes #290. Built on #283 (and so #280); merge those first. This branch carries their commits.

1. The block bar dropped to the tabs after a tap.

  • Cause: one selected block is a selection across one line, which looks exactly like selected words. Any later editor update re-read the selection that way. That covers focus moving to the bar or away, the keyboard going down, a tap outside the note, and Copy link. The block turned into words and then into nothing, and with nothing selected the bar fell back to the tabs (on prod) or the note tools.
  • Fix (refresh in editing.svelte.ts): while the selection still covers what was selected, or covers whole lines after an edit, it stays a block selection until you put it down. You put it down with ✓, Esc, or a tap into the text.
  • Logging: every bar change is now logged with its reason in tests (window.__modeLog, from setMode). The editor gives reasons such as blocks selected (focus).
  • Tests in e2e/bar-stays.spec.ts, one per tap target:
    • the bar's own buttons, and a sheet opened from the bar coming back to the block bar;
    • focus moving away, and a tap outside the note;
    • a link chip, the empty last bullet, another block's words, and ✓.
  • Proof: without the fix, three of these fail: focus moving away, a tap outside the note, and Copy link.

2. Where the bar sits on a phone. It rests at max(safe-area, 8px) + 6px above the bottom of what you can actually see.

  • Layout: bar.css now has calc(max(var(--safe-bottom), 8px) + 6px). That's the only CSS change, kept minimal because of #287.
  • Correction from the visual viewport: the bar's position is corrected against the visual viewport (keyboard.svelte.ts). The bar's natural spot is now measured correctly even mid-animation.
  • No phantom keyboard: a shorter view with nothing focused is never taken for a keyboard.
  • Never clipped: the bar never goes below the box that clips it.
  • Tests: e2e/bar-rest.spec.ts covers 320, 375, 390 and 430, each as Safari (no inset), the installed app (display-mode: standalone faked, 34 px inset), and a page box that ends above the screen's bottom.
  • For #293: if the installed app's page box really is shorter than the screen, the bar now sits on that box's edge, whole and not clipped. Sizing the box itself is #293's.

3. Bar buttons only answered a long press.

  • Cause: reproduced with real touch in WebKit (hasTouch and isMobile with touchscreen.tap). The keep-focus rule cancelled the touch's pointerdown, and WebKit then never sends the click: the event log showed pointerdown, touchstart, pointerup, touchend, and no click. With the old rule, all four block-bar buttons miss.
  • Fix (Bar.svelte): only a mouse's pointerdown is cancelled. For a finger, the mousedown that comes after it lifts is cancelled instead, which still keeps focus in the text.
  • Tests:
    • e2e/bar-taps.spec.ts taps every control with real touch in WebKit and Chromium: note tools, text bar, block bar, and all 14 Style-sheet controls. Nothing misses.
    • bar-focus.spec.ts and bar-stays.spec.ts now use real taps in both engines, and focus still never leaves the text.

4. Selecting a block by touch. packages/editor/src/blocks/touch.ts, wired into the block chrome, does this:

  • A swipe across a block, either way, selects it.
  • A tap on the block's edge (the margin left of the text) or on its bullet selects it.
  • A tap on the words types.
  • A selecting touch is cancelled before it ends, so the caret doesn't move and the keyboard stays down.
  • A swipe that starts at the screen's left edge is left alone, so swipe-back still works.
  • Tested in e2e/touch-select.spec.ts. Chromium uses real CDP touches. WebKit can't drive a finger across the page, so its swipes are dispatched touch events, which checks our handling rather than WebKit's.

Also changed:

  • keyboard.spec.ts checks the absolute resting spot.
  • bar-focus.spec.ts and bar-stays.spec.ts use isMobile taps.

🤖 Generated with Claude Code

Closes #290. **Built on #283 (and so #280); merge those first.** This branch carries their commits. **1. The block bar dropped to the tabs after a tap.** - **Cause:** one selected block is a selection across one line, which looks exactly like selected words. Any later editor update re-read the selection that way. That covers focus moving to the bar or away, the keyboard going down, a tap outside the note, and Copy link. The block turned into words and then into nothing, and with nothing selected the bar fell back to the tabs (on prod) or the note tools. - **Fix** (`refresh` in `editing.svelte.ts`): while the selection still covers what was selected, or covers whole lines after an edit, it stays a block selection until you put it down. You put it down with ✓, Esc, or a tap into the text. - **Logging:** every bar change is now logged with its reason in tests (`window.__modeLog`, from `setMode`). The editor gives reasons such as `blocks selected (focus)`. - **Tests** in `e2e/bar-stays.spec.ts`, one per tap target: - the bar's own buttons, and a sheet opened from the bar coming back to the block bar; - focus moving away, and a tap outside the note; - a link chip, the empty last bullet, another block's words, and ✓. - **Proof:** without the fix, three of these fail: focus moving away, a tap outside the note, and Copy link. **2. Where the bar sits on a phone.** It rests at `max(safe-area, 8px) + 6px` above the bottom of what you can actually see. - **Layout:** `bar.css` now has `calc(max(var(--safe-bottom), 8px) + 6px)`. That's the only CSS change, kept minimal because of #287. - **Correction from the visual viewport:** the bar's position is corrected against the visual viewport (`keyboard.svelte.ts`). The bar's natural spot is now measured correctly even mid-animation. - **No phantom keyboard:** a shorter view with nothing focused is never taken for a keyboard. - **Never clipped:** the bar never goes below the box that clips it. - **Tests:** `e2e/bar-rest.spec.ts` covers 320, 375, 390 and 430, each as Safari (no inset), the installed app (`display-mode: standalone` faked, 34 px inset), and a page box that ends above the screen's bottom. - **For #293:** if the installed app's page box really is shorter than the screen, the bar now sits on that box's edge, whole and not clipped. Sizing the box itself is #293's. **3. Bar buttons only answered a long press.** - **Cause:** reproduced with real touch in WebKit (`hasTouch` and `isMobile` with `touchscreen.tap`). The keep-focus rule cancelled the touch's `pointerdown`, and WebKit then never sends the click: the event log showed pointerdown, touchstart, pointerup, touchend, and no click. With the old rule, all four block-bar buttons miss. - **Fix** (`Bar.svelte`): only a mouse's `pointerdown` is cancelled. For a finger, the `mousedown` that comes after it lifts is cancelled instead, which still keeps focus in the text. - **Tests:** - `e2e/bar-taps.spec.ts` taps every control with real touch in WebKit and Chromium: note tools, text bar, block bar, and all 14 Style-sheet controls. Nothing misses. - `bar-focus.spec.ts` and `bar-stays.spec.ts` now use real taps in both engines, and focus still never leaves the text. **4. Selecting a block by touch.** `packages/editor/src/blocks/touch.ts`, wired into the block chrome, does this: - A swipe across a block, either way, selects it. - A tap on the block's edge (the margin left of the text) or on its bullet selects it. - A tap on the words types. - A selecting touch is cancelled before it ends, so the caret doesn't move and the keyboard stays down. - A swipe that starts at the screen's left edge is left alone, so swipe-back still works. - Tested in `e2e/touch-select.spec.ts`. Chromium uses real CDP touches. WebKit can't drive a finger across the page, so its swipes are dispatched touch events, which checks our handling rather than WebKit's. **Also changed:** - `keyboard.spec.ts` checks the absolute resting spot. - `bar-focus.spec.ts` and `bar-stays.spec.ts` use `isMobile` taps. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Phone: text bar while typing; the bar never takes focus; sheets fit above the keyboard (#268)
Some checks failed
CI / server (pull_request) Successful in 22s
CI / web (pull_request) Failing after 24s
CI / rust (pull_request) Successful in 1m53s
4c15a581b2
- Caret in the text on a phone: the bar is the text bar. The note tools
  (Log, Insert, Style, Info, Source) show when the keyboard is down, or
  blocks are selected.
- Nothing in the bar or its sheets takes focus from the text: presses keep
  focus (pointerdown and mousedown), and actions only refocus the editor if
  it really lost focus. Focusing an already focused editor made iOS move
  its keyboard.
- B, I, S, code and highlight with just a caret start the mark right there.
- Sheets are never taller than what you can see above the bar
  (--sheet-room from the visual viewport).
- e2e/bar-focus: with a faked keyboard, every text-bar button and the
  Style sheet's controls keep focus in the text; the sheet fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
e2e: on a phone, the note tools are there with the keyboard down (#268)
Some checks failed
CI / web (pull_request) Failing after 36s
CI / server (pull_request) Successful in 53s
CI / rust (pull_request) Successful in 1m33s
541d5bdacd
editor.spec and day.spec put the keyboard down before using the note tools
at phone width; keyboardDown lives in viewport.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
One bar for every mode: shared Bar, registered modes, one look (#269)
Some checks failed
CI / server (pull_request) Successful in 23s
CI / web (pull_request) Failing after 24s
CI / rust (pull_request) Successful in 1m44s
f42f3c59d4
- @calternal/ui/bar: Bar (the capsule frame: Morph with its glass, halo
  and spring, the keep-focus rule from #268, the phone scrim), barModes
  (each mode a registered plugin: role, label, component) and pick.ts
  (#268's rule for which mode shows, unit tested).
- styles/bar.css: the rows, pills, tabs, toast and question styles, once,
  for the app and the mockup (the mockup's pill tabs on a phone).
- The app's modes are small files in components/bar (tabs, note tools, text
  bar, block bar, sheets, toast, ask); BottomBar only picks and hands them a
  context. The mockup's bar is the same Bar with the same styles.
- On a phone the question's answer no longer takes focus (#268).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
- A block selection stays one until it's put down (✓, Esc, a tap into the
  text): a later editor update (focus moving to the bar or away, a sheet
  closing, a sync) no longer turns one selected line into selected words
  and then nothing, which swapped the block bar for the tabs.
- Every bar mode change is logged with its reason in tests (__modeLog).
- One tap fires every bar and sheet control: keep-focus no longer cancels
  a touch's pointerdown (iOS dropped the click; only a long press worked);
  it cancels the touch's mousedown, which keeps focus.
- By touch, a swipe across a block (either way) or a tap on its edge or
  bullet selects it; a tap on the words types (blocks/touch.ts).
- The phone bar rests at max(safe area, 8px) + 6px above the bottom of
  what you can see, corrected from the visual viewport, so it no longer
  floats with a page box that ends above the screen (installed app); a
  view shorter without anything focused is never taken for a keyboard.
- Tests: bar-stays (each tap target), bar-taps (every control by real
  touch, WebKit and Chromium), touch-select, bar-rest (320/375/390/430,
  browser and standalone shapes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Phone bar: measure its spot mid-spring; never below the box that clips it (#290)
Some checks failed
CI / server (pull_request) Successful in 24s
CI / web (pull_request) Failing after 27s
CI / rust (pull_request) Successful in 1m48s
093bb867ff
The bar's natural spot is read from where it's drawn less the shift it's
drawn with, so a keyboard change landing mid-spring is measured right; and
the rest position is never below the box that clips the bar (a page box
ending above the screen is #293's to size). keyboard.spec checks the
absolute rest spot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Landed in merge train #329.

Landed in merge train #329.
kayg closed this pull request 2026-10-14 17:39:16 +00:00
Some checks failed
CI / server (pull_request) Successful in 24s
CI / web (pull_request) Failing after 27s
CI / rust (pull_request) Successful in 1m48s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!308
No description provided.