Skip to content

fix(web): keep composer text above its controls and center select icons - #146

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/87-the-text-in-the-composer-box-on-mobile-e
Oct 20, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/87-the-text-in-the-composer-box-on-mobile-e

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

On a phone, a long task in Home's composer ran under the paperclip, the project select and the Start button. The workspace's logo in the project select also sat higher than the project's name, on phones and on desktop.

What was wrong

The composers (on Home, a project's page and a session's page) laid their controls over the bottom of the textarea and gave it a bottom padding as tall as them. Once the text was long enough to scroll, typing brought the caret into view only as far as the textarea's edge, inside that padding, so the last lines ended up under the controls. Safari and Chrome both do this; a phone shows it sooner, because the same text takes more lines there.

A Select put its icon in an inline box, so an avatar (itself an inline box) sat on the text's baseline instead of in the middle: 2.9 px high in Home's project select, 2.5 px low in the new-project page's workspace select, and up to 7 px low beside the options in their lists.

What changed

  • Composers. The controls sit in a row of their own under the textarea (TextareaControls in ui/form.tsx), so text can't scroll under them. A press between the controls still focuses the text, as a press on the old padding did. At rest, every composer keeps its height and its controls their places.
  • Textarea height. Textarea counts its real padding when it grows, instead of assuming the 16 px that only the bordered fields have, so minRows and maxRows hold for the bare composers too. With the controls out of the textarea, each composer keeps its tallest size by growing to as many lines as it showed before: 8 on Home, 12 on a project's page, 10 in a session.
  • Small fixes in the same rows. The paperclip no longer shrinks when a phone's row runs short (it was 27 px wide at 390 px, 18 px at 320 px). A session's "↵ send · ⇧↵ new line" hint ends in an ellipsis on a narrow phone instead of running under Interrupt. On a project's page the paperclip is centered with "Start a session" (it sat 2 px lower).
  • Select icons. The trigger's icon sits in a flex box, so it is centered; an option's icon sits in a box as tall as the option's first line, centered on it.

How I verified it

  • Unit tests: Textarea grows to maxRows lines and keeps minRows lines plus its real padding (both fail with the old 16 px); TextareaControls focuses the textarea on a press between the controls without letting the focus leave, and leaves presses on a control, and with other mouse buttons, alone. cargo xtask check passes.
  • With cargo xtask dev and Playwright, I typed a long task into each composer at 390 px in WebKit and Chromium, and compared where the last line ends with where the controls start. On main it ended under them in all six cases (Home in WebKit: the line ends at 581 px, the controls start at 543 px). On this branch it ends above them in all six: the textarea stops 16, 8 and 6 px above the controls.
  • At rest, main and this branch match pixel for pixel in a session's composer. On Home only the avatar moves (and on a phone the paperclip, now a full 32 px wide), and on a project's page only the paperclip.
  • Presses in the row, in Chromium and WebKit, with a mouse and with touch: a press between the controls focuses the text (with no blur when it already had the focus), the select opens its list and the paperclip opens the file chooser. A tap squarely in the 16 px gap between two controls goes to the nearer control in WebKit, which adjusts taps to nearby targets as in any toolbar.
  • Select icons, measured: 0 px from the middle in both selects' triggers and beside every option.

Screenshots

At bbac36b, with cargo xtask dev's data.

Home on a 390 px phone (WebKit, dark theme), after typing a long task:

Home's composer on a phone with a long task: before, the last line runs under the paperclip, the project select and Start; after, it ends above them

A session's composer while its agent works, on a 320 px phone (WebKit, light theme). Before, the text and the key hint both ran under the controls:

A session's composer on a 320 px phone: before, the last line runs under the controls and the hint under Interrupt; after, both stay clear

Home's composer at rest on desktop (dark theme): nothing moves but the project's avatar.

Home's composer on desktop, before and after: the same, except that the workspace avatar in the project select is centered after

The project select on a phone, close up:

The project select: before, the hyperstructure logo sits above the middle of the name; after, it is centered

The workspace select's list on the new-project page (light theme):

The new-project page's workspace list: before, the avatars sit below the workspace names; after, each is centered on its name

Made in the fctl session https://app.fctl.sh/s/ses_01M5CYZK8F3HY8PYV5BNN4ZV89.

The composers on Home, a project's page and a session's page laid their
controls over the bottom of the textarea, which left a bottom padding as
tall as them. Once a long text scrolled, the browser brought the caret
into view only as far as the textarea's edge, which put the last lines
under the attach button, the project select and the Start button
(Safari and Chrome alike). The controls now sit in a row of their own
under the textarea (TextareaControls), and a press between them still
focuses the text. The textarea's height counts its real padding instead
of assuming 16 px, and each composer keeps its tallest size: 8, 12 and
10 lines, as many as showed before. The paperclip no longer shrinks on
a phone, and a session's key hint truncates instead of running under
Interrupt.

A Select's icon sat in an inline box, so an avatar sat on the text's
baseline: about 3 px high in the trigger, and up to 7 px off in the
list. The icon now sits in a flex box, centered in the trigger and on
its option's first line.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 20, 2026 16:03
@kalaspuff
kalaspuff merged commit 9b26704 into main Oct 20, 2026
5 checks passed
@kalaspuff
kalaspuff deleted the fctl/87-the-text-in-the-composer-box-on-mobile-e branch October 20, 2026 16:37
kalaspuff pushed a commit that referenced this pull request Oct 20, 2026
On Home, pressing a project in the composer's project list didn't pick
it. The list closed, the task field took focus, and the project stayed
the same. app.fctl.sh has had this bug since #146 was deployed. No
release has it yet.

## What was wrong

#146 moved the composer's controls into a row of their own,
`TextareaControls`. A press between the controls focuses the textarea,
as a press in its margins does, but presses on links, buttons, inputs
and labels are left alone. Home's project `Select` is in that row. Its
list opens in the top layer, over the page, but in the DOM it is still
inside the row. So a press on an option counted as a press between the
controls. The textarea took focus, the `Select`'s trigger lost it, and
the `Select` closed its list on that blur. Once the list starts closing
it stops taking the pointer, so the click that followed missed the
option.

## What changed

`TextareaControls` also leaves presses in a popover alone. A `Select`'s
list is a popover.

## Verification

- A new unit test in `form.test.tsx` puts a `Select` in
`TextareaControls`, opens it, then presses and clicks an option. Before
the change, the press moved focus to the textarea. Now the trigger keeps
focus and the click picks the option.
- On the real Home page with `cargo xtask dev` and two projects,
Playwright (Chromium) pressed the project that wasn't selected. It used
a mouse, taps at a Pixel 7's size, and taps at an iPhone 15's size, the
last with Safari's focus rule added as in #151. WebKit on Linux refuses
the dev stack's `__Host-` cookie over http, so these runs used Chromium.
On `main`, the picker stayed on Playground and focus moved to the task
field in all three. With this change, it picks Notes, closes the list
and keeps focus on the picker.
- On a page with the same components, Playwright also used a mouse in
desktop WebKit and Firefox, and taps on an emulated iPhone 15 in WebKit.
Before, a press on an option picked nothing. Now it picks, and a press
between the controls still focuses the textarea.
- With #151 applied as well, every check of both pull requests passes.
On the iPhone, a second press on the picker also closes its list.
- `cargo xtask check --quick` passes.

There are no screenshots: nothing looks different.

Session: https://app.fctl.sh/s/ses_01M5DCMP24RSTE8CGHSVH4A4A9

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant