Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(ChatComposerInput): avoid scrolling for a single-line draft (#6734)

zakelstorm0a5483ebe0ad
diff --git a/.changeset/chat-composer-input-single-line-scroll.md b/.changeset/chat-composer-input-single-line-scroll.md
new file mode 100644
index 0000000000..beec650d05
--- /dev/null
+++ b/.changeset/chat-composer-input-single-line-scroll.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] ChatComposerInput no longer scrolls for a short single-line draft with `maxRows={1}`. Removing vertical padding also keeps the empty input and placeholder aligned when disabled. (#6733)
+
+@korkt-kim
diff --git a/packages/core/src/Chat/ChatComposerInput.tsx b/packages/core/src/Chat/ChatComposerInput.tsx
index 3d7c72637c..fb0c25b355 100644
--- a/packages/core/src/Chat/ChatComposerInput.tsx
+++ b/packages/core/src/Chat/ChatComposerInput.tsx
@@ -238,18 +238,7 @@ const styles = stylex.create({
position: 'relative',
display: 'flex',
flexDirection: 'column',
- // The single-line floor, not just the line-height: `editable` and
- // `placeholder` both add `spacingVars['--spacing-1']` padding on the
- // block axis on top of their shared line-height, and normally that's
- // what keeps the root this tall (the editable region reserves its own
- // padded box even when empty). A disabled, empty editable stops
- // reserving that empty line at all in Chromium (contentEditable=false
- // collapses to just its padding), and the absolutely positioned
- // placeholder that would otherwise stand in for it doesn't contribute
- // to layout height — so without this explicit floor accounting for the
- // same padding, the root shrinks by that padding's height the moment
- // isDisabled flips true, moving anything bottom-aligned beside it.
- minHeight: `calc(${LINE_HEIGHT_PX}px + 2 * ${spacingVars['--spacing-1']})`,
+ minHeight: `${LINE_HEIGHT_PX}px`,
},
editable: {
outline: 'none',
@@ -269,7 +258,7 @@ const styles = stylex.create({
fontFamily: typographyVars['--font-family-body'],
color: colorVars['--color-text-primary'],
caretColor: colorVars['--color-accent'],
- padding: spacingVars['--spacing-1'],
+ paddingInline: spacingVars['--spacing-1'],
},
placeholder: {
position: 'absolute',
@@ -288,7 +277,7 @@ const styles = stylex.create({
lineHeight: `${LINE_HEIGHT_PX}px`,
fontFamily: typographyVars['--font-family-body'],
userSelect: 'none',
- padding: spacingVars['--spacing-1'],
+ paddingInline: spacingVars['--spacing-1'],
},
disabled: {
opacity: 0.5,