Skip to content

Commit f887c52

Browse files
authored
ui(editor): fix incorrect heights of page title/subtitle (#4645)
Fixes FER-7522 ## Short description of the changes made - fixes height issue where PageTitle and PageSubtitle were too tall on some docs sites ## What was the motivation & context behind this PR? - line height was messing with textarea height ## How has this PR been tested? - tested locally w square docs
1 parent 958245d commit f887c52

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/fern-dashboard/src/components/input/AutoResizingInput.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ export function AutoResizingInput({
1616
useEffect(() => {
1717
const textarea = textareaRef.current;
1818
if (textarea) {
19-
textarea.style.height = "auto";
20-
textarea.style.height = `${textarea.scrollHeight}px`;
19+
// Reset height to get accurate scrollHeight measurement
20+
textarea.style.height = "0";
21+
// Set height based on scrollHeight
22+
const newHeight = textarea.scrollHeight;
23+
textarea.style.height = `${newHeight}px`;
2124
}
2225
}, [value]);
2326

2427
return (
2528
<textarea
2629
ref={textareaRef}
27-
className={cn("w-full flex-1 resize-none overflow-hidden focus:outline-none", className)}
30+
className={cn("w-full flex-1 resize-none overflow-hidden focus:outline-none leading-none", className)}
2831
name={name}
2932
onChange={onChange}
3033
placeholder={placeholder}

0 commit comments

Comments
 (0)