refactor(web): every textarea caps its growth; the diff comment box is a Textarea (#13036)

Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Fable 5 authored and GitHub committed 2026-09-22 12:22:17 -07:00
1 parent d7736e06b6
commit da89e102f8
6 files changed
+5 -10

No files matched your search

@@ -25,10 +25,8 @@ describe("DiffCommentAnnotation", () => {
expect(markup).toContain("Add a comment…");
expect(markup).toContain(">Comment</button>");
expect(markup).toContain("autofocus");
const textareaControl = markup.match(/<span[^>]*data-slot="textarea-control"[^>]*>/)?.[0];
expect(textareaControl).toBeDefined();
expect(textareaControl).not.toContain("ring-ring");
expect(markup).toContain("cursor-text");
// The comment box is the standard small Textarea, not a bespoke surface.
expect(markup).toMatch(/<span[^>]*data-size="sm"[^>]*data-slot="textarea-control"/);
});
it("lets a pull-request diff configure actions without replacing the composer", () => {
@@ -91,8 +91,6 @@ export function DiffCommentAnnotation({
<Textarea
ref={textareaRef}
autoFocus={focusOnMount}
unstyled
className="relative inline-flex w-full rounded-md border border-border/50 bg-background/20 font-sans text-foreground transition-colors focus-within:border-border/70 [&_[data-slot=textarea]]:min-h-12 [&_[data-slot=textarea]]:cursor-text [&_[data-slot=textarea]]:caret-foreground [&_[data-slot=textarea]]:px-2.5 [&_[data-slot=textarea]]:py-1.5 [&_[data-slot=textarea]]:font-sans [&_[data-slot=textarea]]:text-xs [&_[data-slot=textarea]]:leading-5 max-sm:[&_[data-slot=textarea]]:min-h-12"
size="sm"
value={displayedText}
placeholder={placeholder}
@@ -85,7 +85,6 @@ export function PullRequestCommentForm({
<div className="space-y-2">
<Textarea
ref={textareaRef}
className="[&_textarea]:max-h-64"
// Locked while posting: the body is cleared on success, which would otherwise throw
// away a new draft typed while the request was still in flight.
disabled={submitting !== null || actionPending}
@@ -126,7 +126,6 @@ export function PullRequestReviewForm({
<Textarea
ref={textareaRef}
rows={3}
className="[&_textarea]:max-h-64"
value={body}
placeholder={
requestChangesSummaryRequired && verdicts.includes("request-changes")
+2 -1
View File
@@ -28,7 +28,8 @@ function Textarea({ className, size = "default", unstyled = false, ...props }: T
render={(defaultProps) => (
<textarea
className={cn(
"field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5",
// Auto-grows with content up to one cap, then scrolls.
"field-sizing-content min-h-17.5 max-h-64 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5",
size === "sm" &&
"min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5",
size === "lg" && "min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5",
+1 -1
View File
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
// migrate a file, and delete this script when the rule becomes an error.
export const RESTYLE_CEILING = 826;
export const RESTYLE_CEILING = 812;
const RULE = "shadcn(no-restyle)";