Chat input (typing-time feedback)
The user types into a chat composer. The input must echo inside the perceptual frame Card-Moran-Newell Card, Moran & Newell 1983 describe — anything the input does that blocks for more than 50 ms (typeahead suggestions, mention parsing, markdown preview) puts the user in the same active-mode trap search-as-you-type covers.
The reuse-affinity is high: a chat composer is a search input plus a send button. Eizenberg's Eizenberg production-surface argument is the same here — every perception trick must protect the input itself, not paper over it.
Search as you type
Same dataset, same filter logic, same artificial work per keystroke. The naive side blocks input on every keystroke; the tuned side uses React 19's useDeferredValue to keep the input instant while the filter catches up.
Off
38 results
- Apple
- Apricot
- Avocado
- Banana
- Blackberry
- Blueberry
- Cherry
- Coconut
- Cranberry
- Date
- Dragon fruit
- Elderberry
- Fig
- Grape
- Grapefruit
- Guava
- Honeydew
- Kiwi
- Kumquat
- Lemon
- Lime
- Lychee
- Mango
- Mulberry
- Nectarine
- Orange
- Papaya
- Passion fruit
- Peach
- Pear
- Persimmon
- Pineapple
- Plum
- Pomegranate
- Raspberry
- Strawberry
- Tangerine
- Watermelon
On
38 results
- Apple
- Apricot
- Avocado
- Banana
- Blackberry
- Blueberry
- Cherry
- Coconut
- Cranberry
- Date
- Dragon fruit
- Elderberry
- Fig
- Grape
- Grapefruit
- Guava
- Honeydew
- Kiwi
- Kumquat
- Lemon
- Lime
- Lychee
- Mango
- Mulberry
- Nectarine
- Orange
- Papaya
- Passion fruit
- Peach
- Pear
- Persimmon
- Pineapple
- Plum
- Pomegranate
- Raspberry
- Strawberry
- Tangerine
- Watermelon
What is happening
Same demo as search-as-you-type, framed for the chat case. Naive: synchronous work on every keystroke blocks the input. Tuned: useDeferredValue keeps the input live while the work happens at low priority. Whether the work is "filter a list" or "render markdown preview" or "parse @mentions," the structural answer is the same.
For the send button itself, pair this with optimistic-actions: on Send, render the user's message in the conversation immediately; stream the assistant response in parallel.
What to tune
- Keystroke echo — character renders inside ~50 ms. Anything that blocks the input (markdown parse, mention lookup) runs at low priority via
useDeferredValue. - In-flight side work — markdown preview, mention suggestions, autocomplete all run stale-while-revalidate. The input never waits on them.
- Send press — pre-action feedback within ~50 ms; the button echoes regardless of how long the message takes to commit.
- Optimistic commit — render the user's message in the conversation immediately on Send; clear the composer; let the assistant response stream in parallel.
- Completion — focus returns to the (now-empty) input so the user can keep typing.
When perceived performance hurts you here
Composer surfaces are pure production. A skeleton over the textarea, a spinner over the send button, a "thinking" placeholder where the user is typing — all wrong. Miller 1968's Miller 1968 keystroke-echo tier is unforgiving: if the input lags, no perception trick saves it.
Accessibility
- Don't lose focus on send. After the message commits, focus returns to the (now-empty) input so the user can keep typing.
aria-multiline="true"on textareas; let the browser handle line breaks correctly.prefers-reduced-motionfor any markdown preview animations.- Keyboard send convention — Enter to send, Shift+Enter for newline. Document it visibly the first few times.
References
References · 3
- Card, Moran & Newell 1983
Card, S. K., Moran, T. P., & Newell, A. (1983). The Psychology of Human-Computer Interaction. Lawrence Erlbaum. ~100 ms perceptual frame; the input must echo inside it on every keystroke.
- Miller 1968
Miller, R. B. (1968). Response time in man-computer conversational transactions. Proceedings of the AFIPS Fall Joint Computer Conference, 33(I), 267–277. The keystroke-echo tier (~0.1 s).
- Eizenberg
Eizenberg, E. When Actual Performance Is More Important Than Perceived Performance (Medium). Chat composers are production surfaces — perception over real responsiveness is a tax.