Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

fix(ui): forward the textarea's ref so the flow composer can grow

codingFeng101f05248ae9ce3
diff --git a/client/shared/ui/textarea.tsx b/client/shared/ui/textarea.tsx
index da047db..226e6b9 100644
--- a/client/shared/ui/textarea.tsx
+++ b/client/shared/ui/textarea.tsx
@@ -2,17 +2,28 @@ import * as React from "react"
import { cn } from "@/shared/lib/utils"
-function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
- return (
- <textarea
- data-slot="textarea"
- className={cn(
- "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-sm transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
- className
- )}
- {...props}
- />
- )
-}
+/**
+ * Wraps the native textarea so a caller can still reach the element.
+ *
+ * The ref has to be forwarded: an auto-growing composer measures
+ * `scrollHeight` on every keystroke, and a ref that silently stays null
+ * leaves the box stuck at its minimum height with no warning at runtime.
+ */
+const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<"textarea">>(
+ ({ className, ...props }, ref) => {
+ return (
+ <textarea
+ ref={ref}
+ data-slot="textarea"
+ className={cn(
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-sm transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ className
+ )}
+ {...props}
+ />
+ )
+ }
+)
+Textarea.displayName = "Textarea"
export { Textarea }