Smooth autosizing textareas: wrap field-sizing:content with a ResizeObserver to transition height

jh3yy · x · 2026-10-01

Front-end dev jh3yy shares a practical CSS trick: field-sizing: content autosizes textareas, but the height snaps instead of animating. The fix is to wrap the textarea and sync the wrapper's height with a ResizeObserver, letting the height change go through a CSS transition.

A copy-paste-ready combo for chat inputs, comment boxes, or anywhere you want smooth height animation.

Original post →

More from coding & agent

coding & agent channel →