Wulan takes orders on two form controls: the stiff one field-sizing: fixed, the hanging one on your CSS, and the sizes the browser measures show where the…
Comment boxes, chats, bios, tag inputs: all of them want to follow their content. The JS version is boilerplate and easy to get wrong (a forgotten border, jumps while typing). field-sizing does it in the browser’s layout, and works for <input> and <select> too.
A form control's natural size moves from its attributes to its content
min-height/max-height Without limits, a textarea shrinks to one line when empty and grows without end when it is long. Give it min-height: 3lh and max-height: 10lh (one lh is one line height).height, and an explicit height overrides field-sizing’s size. Its scrollHeight formula also leaves out the border. Use the CSS, drop the script.fixed, so keep a sensible rows as the fallback, or a script as the fallback inside @supports not (field-sizing: content).scrollHeight against clientHeight), the right grows along.min-height is still needed.max-height, then keep typing The box stops at that limit and the rest scrolls. It grows on its own, under control.<select>, pick the shortest option, then the longest The left is always as wide as the longest option; the right follows the one picked.