[Bug] ChatComposerInput shrinks when disabled and empty, shifting placeholder in bottom-aligned rows
Description
An empty ChatComposerInput shrinks when isDisabled changes from false to true. In Chromium, its root height changes from 30px to 22px, while its absolutely positioned placeholder remains 30px tall.
In a bottom-aligned input/button row, this moves the placeholder 8px downward, even though the outer composer's border and height do not change. This is noticeable when clearing a submitted draft and disabling the input while a response is streaming.
Expected: an empty input should retain its single-line minimum height across enabled/disabled states. Multiline growth should still work.
Reproduction
In an app with Astryx's normal styles/StyleX setup, render this component. Leave the input empty and toggle disabled. The native wrappers below intentionally isolate the geometry from application layout and chat/network state.
import {useState} from 'react';
import {ChatComposerInput} from '@astryxdesign/core/Chat';
import '@astryxdesign/core/reset.css';
import '@astryxdesign/core/astryx.css';
export default function Repro() {
const [disabled, setDisabled] = useState(false);
return (
<>
<button onClick={() => setDisabled(value => !value)}>
Toggle disabled: {String(disabled)}
</button>
<div style={{
display: 'grid',
gridTemplateColumns: 'minmax(0, 1fr) auto',
alignItems: 'end',
gap: 12,
padding: 12,
border: '1px solid gray',
width: 360,
}}>
<ChatComposerInput
value=""
onChange={() => {}}
placeholder="Type a message…"
label="Reproduction input"
isDisabled={disabled}
/>
<button style={{width: 36, height: 36}}>↑</button>
</div>
</>
);
}- Keep the draft empty.
- Measure the
ChatComposerInputroot and its placeholder in DevTools. - Toggle disabled on and off.
- The root shrinks by 8px and the placeholder moves down; enabling restores its position.
Browser measurements from the actual component in our application (before a local workaround):
| Measurement | Enabled, empty | Disabled, empty |
|---|---|---|
| Outer composer height | 62px | 62px |
| Input root height | 30px | 22px |
| Editable child height | 30px | 8px |
| Placeholder height | 30px | 30px |
| Placeholder top, viewport coordinates | 465.98px | 473.98px |
These were measured on the real component during a guest-submit flow that disables input while opening authentication. The full authenticated streaming flow was not exercised; no network or authentication is necessary for the minimal toggle reproduction above.
Apparent cause / workaround
The current implementation gives the root minHeight: 22px, while both the editable element and the placeholder have a 22px line height plus 4px padding on each vertical side.
When an empty editable element becomes contentEditable=false, Chromium no longer reserves its empty editable line. Its height collapses to its padding. The root then falls back to 22px, and the absolute placeholder does not contribute to layout height.
A local xstyle minimum height of 30px on ChatComposerInput prevents the shift. With that workaround, browser measurements confirmed an unchanged placeholder position and normal growth to 74px for three lines. An upstream fix should keep the empty single-line geometry consistent, accounting for padding rather than only the line height.
The bottom-aligned row makes the shift visible, but the enabled/disabled root-height difference originates inside ChatComposerInput.
Astryx Version
- Browser reproduction:
@astryxdesign/[email protected](current npmlatest). - Also inspected the published
0.6.3-canary.5937ac3source andmainat5937ac3b29c46ad4cc2e8967c7014d6f5a35c549: the relevant sizing/placeholder implementation is unchanged. Canary/main were source-inspected, not separately browser-tested.
Environment
Chromium headless on Linux, desktop viewport, React 19. Other browser engines have not been verified.
Source: facebook/astryx