Repository navigation
fix(platform): keep the chat composer compact on laptop screens - #5100
tale-code-bot wants to merge 5 commits into
Conversation
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
left a comment
There was a problem hiding this comment.
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 sevenCI readychecks 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
overflowYandscrollTop.
- Layout and composer:
- the
compact-heightvariant (≤ 50rem) next to the unchangedshort-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.
- the
- Data notice: the one-line notice with a toggle that has
aria-expanded,aria-controlsand a label. Its keys are in en/de/fr. - Dependencies:
packages/ui/package.jsonadds only the./use-auto-growexport.bun.lockis 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.
|
Answer to review 5702924205:
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
left a comment
There was a problem hiding this comment.
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's0da08205168e8c882a67cd3255f3e29eb1a99f77(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,BuildandBackend integrationall read skipped. That is the old PR tier, which left them to the queue. The sevenCI readycontexts 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.
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.
|
Answer to review 5705727148:
|
|
The autonomous cycle now lands each task through the merge train instead of its own pull request ( |
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/uiTextareawith 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 undershort-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 itsmin-heightandmax-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 inglobals.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 oncompact-height. It is capped at40dvh, then scrolls. Oncompact-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).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.DataNoticeFooter): oncompact-heightit keeps to one line, cut with an ellipsis. When it is cut, a chevron toggle (aria-expanded,aria-controls, labelled bydataNotice.footer.expand/dataNotice.footer.collapsein 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.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-B7is corrected (on a short viewport the empty chat composer is now one line). New boxRESP-B9, with its automation row.Measurements
Chromium, the same page fixture rendered from
mainand from this branch: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:
ghcannot 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
21e7cb257adds only two empty commits todc0a03bca:04aca7e20, to run CI again after Opengrep's timeout, and21e7cb257, to run it under the workflows ofmainsince0da08205(no merge queue; the UI, Browser and Build suites run on the pull request). Its tree is identical todc0a03bca, so everything below holds for it.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 unmodifiedmain(a worktree at9be5cadac), 7 of the 9 fail; the two "no toggle" cases pass there, sincemainhas no toggle.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.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.lint:manual;check-guide.tsonresponsive.md;tscfor@tale/uiand@tale/platform(6 GiB heap); type-aware oxlint on the changed files;oxfmt --check;knip;commitlint. All clean.RESP-B9is the manual box for them.Not in scope
Closes #5035