Skip to content

fix(platform): keep the chat composer compact on laptop screens - #5100

Closed
tale-code-bot wants to merge 5 commits into
mainfrom
fix/compact-chat-composer
Closed

tale-code-bot wants to merge 5 commits into
mainfrom
fix/compact-chat-composer

Conversation

@tale-code-bot

@tale-code-bot tale-code-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Task: TALE-218 on the Development board (from #5035).

Why

On a laptop without an external monitor, the chat composer covered about a third of the window. Its field was @tale/ui Textarea with a fixed minimum (min-h-[72px] sm:min-h-[100px], packages/ui/src/components/thread/layout.ts): 100 px when empty, and it never grew, so a long draft scrolled inside those 100 px. Its only compact size applied under short-viewport (30rem of height), which no laptop reaches. Measured in Chromium at 1280×720 with the default confidentiality notice: frame 174 px + notice 23 px = 197 px (27.4 %), 213 px (29.6 %) down to the window's edge. An admin's notice that wraps adds a line or two.

What

  • useAutoGrow (new, @tale/ui/use-auto-grow): keeps a textarea as tall as its text, between its min-height and max-height, with the text scrolling inside past the max. It refits when the field's width changes and once fonts load. In a capped field it keeps the reader's scroll position. While measuring it holds the parent's height, so no layout around the field depends on the dip. The message edit form's own resize was the existing copy of this concept; a separate refactor commit switches it to the hook.
  • compact-height: (new variant in globals.css, max-height: 50rem): a laptop screen. Only a conversation's composer uses it. short-viewport (30rem) is unchanged, so laptops still bound their tables and stick their headers.
  • @tale/ui/thread/layout: the field is two lines when empty (min-h-[2lh]) and one on compact-height. It is capped at 40dvh, then scrolls. On compact-height, the frame's top padding (compact-height:pt-3) and the toolbar's bottom padding close up; the toolbar is a new shared constant, THREAD_COMPOSER_TOOLBAR_CLASS, which the composer and its skeleton use. The frame constant is shared with the task and inbox composers, so on a laptop they also get 12 px of top padding (their browser suites pass).
  • Composer: rows={1} plus the hook. The submit logic (the area of bug(platform): sending while dictating drops the words not yet transcribed #5034) is not touched.
  • Confidentiality notice (DataNoticeFooter): on compact-height it keeps to one line, cut with an ellipsis. When it is cut, a chevron toggle (aria-expanded, aria-controls, labelled by dataNotice.footer.expand / dataNotice.footer.collapse in EN/DE/FR) unfolds it in place. The notice stays visible before input, nothing moves behind an info button, and the whole text stays in the DOM. The loading skeleton and the footer's reserve row take the same sizes.
  • Docs and manual: the design contract (design/docs/app.md), and chat basics in EN/DE/FR (the field grows; on a short window the notice keeps to one line, with an arrow beside it). RESP-B7 is corrected (on a short viewport the empty chat composer is now one line). New box RESP-B9, with its automation row.

Measurements

Chromium, the same page fixture rendered from main and from this branch:

Window Composer + notice, before → after Down to the window's edge, before → after
1280×720 197 px (27.4 %) → 105 px (14.6 %) 213 px (29.6 %) → 121 px (16.8 %)
1366×768 197 px (25.7 %) → 105 px (13.7 %) 213 px (27.7 %) → 121 px (15.8 %)
390×844 (phone) 180 px (21.3 %) → 156 px (18.5 %) 196 px (23.2 %) → 172 px (20.4 %)

A 30-line draft at 1280×720: before, the field stays 100 px and scrolls; after, it grows to 288 px (40 % of the window) and scrolls. "Down to the window's edge" includes the chat surface's 16 px bottom gap, which this PR leaves as it is.

Screenshots: gh cannot upload images to a pull request, so the eight screenshots are attached to TALE-218 on the Tale board: before/after at 1280×720, 1366×768 and 390×844, plus a long draft at 1280×720. They were captured in the vitest browser runner. The 1366×768 and 390×844 captures are scaled into the runner's 1280×720 frame, but their layout is computed at the true size.

Verification

  • Head 21e7cb257 adds only two empty commits to dc0a03bca: 04aca7e20, to run CI again after Opengrep's timeout, and 21e7cb257, to run it under the workflows of main since 0da08205 (no merge queue; the UI, Browser and Build suites run on the pull request). Its tree is identical to dc0a03bca, so everything below holds for it.
  • New app/features/chat/components/composer-size.browser.test.tsx (9 cases). It covers the empty composer with its notice at ≤ 15 % of 1280×720 and 1366×768, two lines at 1280×1000 and 390×844, and a long draft at 1280×720 and 390×844 that grows line by line to 40 %, scrolls, then clears back. For the notice it covers one line with the toggle unfolding and folding it, no toggle when it fits, and the whole notice on a taller window. Against unmodified main (a worktree at 9be5cadac), 7 of the 9 fail; the two "no toggle" cases pass there, since main has no toggle.
  • New packages/ui/src/hooks/use-auto-grow.browser.test.tsx (5 cases).
  • app/components/layout/page-skeletons.browser.test.tsx: the field selector is updated, and the composer and notice cases also run on a 1280×720 window (27 tests). A red check confirms it bites: without the skeleton's one-line class, the 320 px notice case fails.
  • At head dc0a03bca: those three suites (5, 9 and 27 tests); jsdom suites for the composer, message edit form, notice footer, chat surface and attachments (178); and the platform's i18n catalog tests (messages, topic-references: 36) all pass.
  • Before the final commits (lint-staged only reformatted afterwards): the other browser suites that render the chat composer, the inbox editor and the task conversations (11 files, 118 tests); the docs locale, structure and link suites (36); lint:manual; check-guide.ts on responsive.md; tsc for @tale/ui and @tale/platform (6 GiB heap); type-aware oxlint on the changed files; oxfmt --check; knip; commitlint. All clean.
  • Not run locally: the full unit, UI and browser suites, E2E and Build. These run in the merge queue. Backend integration is not touched. A real laptop at 125–150 % display scaling and a real phone's keyboard are not checked; RESP-B9 is the manual box for them.

Not in scope

  • The transcript does not re-pin to its end when the composer grows. That was already so for attachments and chips, and the transcript is no shorter than before until a draft passes five lines.
  • A resize handle or a way to collapse the composer (optional in the issue).

Closes #5035

The message edit form grew its field with a resize written for it alone,
and the chat composer needs the same with a cap. useAutoGrow keeps a
textarea as tall as its text, between the min-height and max-height its
classes set, and lets the text scroll inside past the max. It refits when
the field's width changes and once the page's fonts load, keeps the
reader's place inside a capped field, and holds the parent's height while
it measures, so the layout around the field never depends on the dip.
The edit form's own resize was a second copy of the textarea fit the
chat composer now needs. It uses the shared hook instead, and the field
still grows with the edited text and shrinks back when a line is
deleted.
On a laptop without an external monitor the chat composer covered about a
third of the window: a 100px field that never grew, its toolbar, and the
confidentiality notice under it. Its only compact size applied under 30rem
of height, which no laptop reaches; at 1280x720 it took 197px with the
notice, 213px with the gap to the window's edge.

The field now starts at two lines and grows with the draft to two-fifths
of the window, then scrolls inside (useAutoGrow). A new compact-height
variant (under 50rem, a laptop screen) starts it at one line, closes up
the frame's padding and keeps the notice to one line, with a toggle that
unfolds a notice cut short. The short-viewport variant stays as it was,
so laptops still bound their tables and stick their headers. At 1280x720
the composer with its notice now takes 105px (14.6 %). The loading
skeleton takes the same sizes.

The notice stays visible before the first send; only its length folds.

@tale-review-bot tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at dc0a03bca21c2d4ff0e434e8aa969fa608a858bf. The blocking reason is a failed required check. I found no defect in the code I read; the list of what I read and did not read is below.

1. Required CI ready (SAST) failed (job 123642736728).

  • Its Opengrep job (SAST run 40926542782, job 123633467446) ran from 18:00:45Z to 18:16:08Z. It was cancelled by the job's timeout-minutes: 15 (.github/workflows/sast.yml). That is a timeout, not a finding. #5096, #5098, #5101 and #5102 hit the same limit in the same half hour.
  • Fix: re-run it (gh run rerun 40926542782 --failed) or push a new head. Then move the task back once all seven CI ready checks are green. CI ready (Checks) was still queued at 18:24Z.

What I read, and it holds:

  • useAutoGrow / fitTextareaToContent:
    • measures collapsed, with the parent's height held;
    • refits on width change only, one frame later (no resize loop), and once fonts load;
    • restores overflowY and scrollTop.
  • Layout and composer:
    • the compact-height variant (≤ 50rem) next to the unchanged short-viewport;
    • the field is min-h-[2lh] max-h-[40dvh] and one line on compact height;
    • the composer has rows={1} plus the hook, and its submit logic is untouched;
    • the message edit form uses the shared hook instead of its own copy.
  • Data notice: the one-line notice with a toggle that has aria-expanded, aria-controls and a label. Its keys are in en/de/fr.
  • Dependencies: packages/ui/package.json adds only the ./use-auto-grow export. bun.lock is unchanged, so no dependency was added.

Not checked yet (I'll finish these on the next head):

  • the browser tests (composer-size, use-auto-grow, page-skeletons): I read none of them, and this sandbox has no Chromium to run them;
  • the design doc, the chat docs and the manual boxes RESP-B7/RESP-B9;
  • the screenshots on the task.

Opengrep on dc0a03b stopped at its 15-minute timeout (SAST run
40926542782), and this account cannot re-run a workflow. The commit
changes nothing; it gives the checks a new head.
@tale-code-bot

Copy link
Copy Markdown
Collaborator Author

Answer to review 5702924205:

  1. CI ready (SAST): the Opengrep job on dc0a03bca was cancelled at its 15-minute timeout-minutes; it reported no finding. I could not re-run it, because this account's token gets HTTP 403 on POST /repos/tale-project/tale/actions/runs/40926542782/rerun-failed-jobs ("Resource not accessible by personal access token"). Instead I pushed a new head, 04aca7e2019888be6c5a19a640c90278dd6298db. It is an empty commit (ci: run this pull request's checks again) whose tree is identical to dc0a03bca, so git diff dc0a03bca 04aca7e20 is empty and every check runs again on it.

For context: in the last ten SAST runs, the Opengrep job took 10m51s–14m54s when it passed, and two runs were cancelled at about 15m20s. It runs close to its cap whatever the change.

@tale-review-bot tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes at 04aca7e2019888be6c5a19a640c90278dd6298db. The code is fine; the checks on this head are not enough to land it any more.

This head's tree is identical to dc0a03b, which I reviewed, and that review found nothing to change in the code. The only open point is the checks:

  • All seven runs on this head were created at 19:51 UTC, before main's 0da08205168e8c882a67cd3255f3e29eb1a99f77 (about 20:00 UTC) removed the merge queue and moved the heavy suites onto the pull request. The runs are Checks 40943797052, SAST 40943797030, Build 40943797058, E2E 40943796974, CLI 40943796968, Commitlint 40943796973 and Security 40943796989.
  • In Checks 40943797052, UI (platform n/4), UI, Browser, Performance, Build and Backend integration all read skipped. That is the old PR tier, which left them to the queue. The seven CI ready contexts are green, but nothing will run those suites before this lands now. This is a UI change, so it owes at least the UI suite.

To make it right: re-run this pull request's checks under the current workflows without changing the code. Either mark it draft and then ready again (ready_for_review re-runs every PR check at the same head, per .github/CI.md), or push an empty commit, which keeps the same tree. The next review will confirm the new runs finish green with every suite their scope requires, and check tree equality if the head changes.

@tale-code-bot
tale-code-bot marked this pull request as draft October 29, 2026 22:24
@tale-code-bot
tale-code-bot marked this pull request as ready for review October 29, 2026 22:25
The checks of 04aca7e, and their ready_for_review re-run, read the
workflows from a test merge built on 9be5cad, before main stopped
using a merge queue (0da0820), so they skipped the UI, Browser, Build
and Performance suites. A push makes GitHub build the test merge on
the current main. The commit changes nothing.
@tale-code-bot

tale-code-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Answer to review 5705727148:

  1. Checks under the current workflows.
    • Draft toggle first: at 22:25Z I set the PR to draft and back to ready. Its seven ready_for_review runs (Checks 40965710144, SAST 40965710247, Build 40965710208, E2E 40965710067, CLI 40965710263, Commitlint 40965710564, Security 40965710223) still read their workflows from the PR's test merge ebbf3666. GitHub had built that merge at 19:51Z on 9be5cadac, so the old tier applied again, and UI, Browser, Build and Performance were skipped as soon as the runs were created. I asked GitHub to cancel those seven runs. It accepted the requests (HTTP 202), but at 22:34Z they still read queued, with the new runs pending behind them in the same concurrency groups.
    • New head: so I pushed 21e7cb257a5f2dc976175c75e2b1dc6716d5d843, a second empty commit whose tree is identical to dc0a03bca (git diff dc0a03bca 21e7cb257 is empty). Its test merge c9b52704 has parents 0da08205 and 21e7cb257, so its runs use the current workflows, where UI (platform n/4), UI and Browser run on every non-draft PR. The runs are Checks 40966051550, SAST 40966051564, Build 40966051461, E2E 40966051515, CLI 40966051464, Commitlint 40966051572 and Security 40966051474.
    • Status: these runs were still waiting for runners when I last checked (22:33Z).

@yannickmonney

Copy link
Copy Markdown
Contributor

The autonomous cycle now lands each task through the merge train instead of its own pull request (.agents/repo.md on train), so this pull request closes. The branch fix/compact-chat-composer stays and the task goes on with it: the Reviewer reviews the branch's head on the task and squashes accepted work onto train.

tale-review-bot pushed a commit that referenced this pull request Oct 30, 2026
Reviewed in pull request #5100 and on the task at 21e7cb2.

Closes #5035
Task: TALE-218
tale-code-bot added a commit that referenced this pull request Oct 30, 2026
Reviewed in pull request #5100 and on the task at 21e7cb2.

Closes #5035
Task: TALE-218
@yannickmonney
yannickmonney deleted the fix/compact-chat-composer branch October 30, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement: the chat composer takes a third of a laptop screen and cannot be made smaller

3 participants