Skip to content

fix: clean up grouped input border rendering - #44690

Merged
dnywh merged 4 commits into
masterfrom
dnywh/fix/fe-2959
Apr 10, 2026
Merged

dnywh merged 4 commits into
masterfrom
dnywh/fix/fe-2959

Conversation

@dnywh

@dnywh dnywh commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix. Resolves FE-2959.

What is the current behaviour?

Grouped inputs strip the inner control border with border-0, while the outer InputGroup is responsible for the visible outline. After #44703, grouped form inputs now receive the correct validation attributes, but the primitive still removes the inner border dimensions entirely. That keeps the visual layer brittle and can lead to inconsistent error rendering, especially in light mode where the grouped password field does not match the Project name input.

The shared ui-patterns input wrapper also inherits the generic inline-end button spacing from InputGroupAddon, which pushes the password copy button slightly too far to the right.

What is the new behaviour?

The shared grouped-input primitive now keeps a transparent inner border instead of removing border widths entirely. The outer InputGroup continues to own the visible border, focus ring and error treatment, but the inner control now has stable border metrics and no redundant dark-mode background override.

The grouped invalid state now also matches the plain input treatment more closely:

  • unfocused error border uses destructive-400
  • focused error border uses destructive
  • error background uses destructive-200

The ui-patterns input wrapper now overrides the inherited inline-end negative margin for its own copy/reveal button addon, so the password copy button sits in the right place without changing spacing for other direct InputGroup consumers.

Before After
CleanShot 2026-04-09 at 13 43 50@2x-91489355-5EEA-4884-BAA2-B93B28F1D7CB CleanShot 2026-04-09 at 13 41 36@2x-5D7E930B-EDB2-4002-9367-34ACE2DF4DB4
CleanShot 2026-04-09 at 14 06 15@2x-05379F74-4CA5-4E6E-9250-CBA2764C1318 CleanShot 2026-04-09 at 14 12 11@2x-11FBC519-D398-4A59-971A-97FBFEF610DE

An easy place to test this is the Database password field in the New Project creation flow. See also the Minimum password length field in Email (Sign In / Providers).

Summary

  • update packages/ui/src/components/shadcn/ui/input-group.tsx
  • replace border-0 on grouped inputs/textareas with transparent borders
  • remove the redundant dark:bg-transparent
  • keep the inner grouped controls visually neutral so the outer group owns the rendered border state
  • align grouped invalid border and background styling with the plain input treatment
  • update packages/ui-patterns/src/DataInputs/Input.tsx so copy/reveal buttons do not inherit the extra right pull intended for other inline-end addons

@dnywh
dnywh requested a review from a team as a code owner April 9, 2026 03:04
@vercel

vercel Bot commented Apr 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Apr 9, 2026 4:17am
docs Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 4:17am
learn Ready Ready Preview, Comment Apr 9, 2026 4:17am
studio-self-hosted Ready Ready Preview, Comment Apr 9, 2026 4:17am
studio-staging Ready Ready Preview, Comment Apr 9, 2026 4:17am
ui-library Ready Ready Preview, Comment Apr 9, 2026 4:17am
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 4:17am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Apr 9, 2026 4:17am

Request Review

@supabase

supabase Bot commented Apr 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Refined InputGroup error-state and control styling (borders, backgrounds, focus behavior) and adjusted the inline-end addon classes for InputGroupAddon in the DataInputs Input component; no public API changes.

Changes

Cohort / File(s) Summary
Input Group Error Styling
packages/ui/src/components/shadcn/ui/input-group.tsx
Adjusted aria-invalid=true group styling: added bg-destructive-200, changed destructive border from border-destructive to border-destructive-400, and force-focused control border to border-destructive when group is invalid. Updated InputGroupInput/InputGroupTextarea to include border border-transparent defaults, focus/readonly border transparency rules, and ensure aria-invalid=true clears control border/background while preserving dark-mode ring error styling.
Input Addon Inline-End Classes
packages/ui-patterns/src/DataInputs/Input.tsx
Updated InputGroupAddon for copy/actions to include overriding className ("pr-1 has-[>button]:mr-0 has-[>kbd]:mr-0") while retaining align="inline-end", customizing spacing rules for child button/kbd elements.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I nudged the borders, soft and bright,
Destructive hues pop into sight,
Addons snug with just the right space,
Inputs hum in tidy grace —
A rabbit hops, approving the place.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: cleaning up grouped input border rendering, which is the core fix in the changeset.
Description check ✅ Passed The PR description comprehensively covers all required template sections with detailed context, before/after screenshots, and testing information.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dnywh/fix/fe-2959

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dnywh dnywh changed the title Fix invalid light mode styling for grouped inputs fix:(ui): invalid light mode styling for grouped inputs Apr 9, 2026

// Error state.
'has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 The error-state CSS selectors on InputGroup use Tailwind has-[] (CSS :has()), which only matches descendants, but when FormControl (Radix Slot) wraps InputGroup directly, aria-invalid=true is merged onto the InputGroup <div> itself—not any descendant—so the selectors never fire. The newly added bg-destructive-200 and border-destructive-400 styles from this PR will have no effect for the ~10+ Studio components that use the FormControl → InputGroup → InputGroupInput pattern (IOPSField, ThroughputField, DiskSizeField, AutoScaleFields, SmtpForm, etc.); only the DatabasePasswordInput path (which passes {...props} down through DataInputs/Input) actually works.

Extended reasoning...

The CSS :has() selector vs. self-match problem

CSS :has() only matches if the specified selector matches a descendant of the element, never the element itself. The InputGroup div has both data-slot="input-group" and aria-invalid="true" on itself when FormControl (Radix Slot) wraps it directly, but the selector has-[[data-slot][aria-invalid=true]] applied to that same div looks for a child or descendant matching [data-slot][aria-invalid=true]. Since the element cannot match its own :has() selector, this condition never evaluates to true.

How Radix Slot propagates aria-invalid

FormControl in form.tsx (lines 121–128) renders <Slot aria-invalid={\!\!error}>. Radix Slot merges all props—including aria-invalid—directly onto the single child element it receives. When the usage is FormControl > InputGroup, the Slot merges aria-invalid=true onto InputGroup's root <div data-slot="input-group">. Neither InputGroupAddon (data-slot="input-group-addon") nor InputGroupInput's inner <input data-slot="input-group-control"> ever receive aria-invalid in this pattern.

Why the PR's fix doesn't work for this pattern

The PR adds bg-destructive-200 and changes border-destructive to border-destructive-400 inside the same has-[[data-slot][aria-invalid=true]] selectors. Since those selectors could never fire for the direct FormControl → InputGroup pattern (for the self-match reason above), the new styling is also permanently suppressed. The ring and border selectors pre-existed with the same broken logic; the PR extends them without addressing the root cause.

Concrete proof

  1. IOPSField (and ~10 similar components): <FormControl><InputGroup><InputGroupAddon>…</InputGroupAddon><InputGroupInput {...field} /></InputGroup></FormControl>
  2. RHF's field object does not include aria-invalid; InputGroupInput passes {...props} to <Input>, which passes to the <input> element—none of these receive aria-invalid.
  3. Slot merges aria-invalid=true onto InputGroup's <div data-slot="input-group">.
  4. CSS evaluates: does div[data-slot="input-group"][aria-invalid="true"] have a descendant matching [data-slot][aria-invalid="true"]? Answer: No — the only matching element is the div itself, and :has() doesn't match self.
  5. Result: none of the error-state classes (bg-destructive-200, ring-destructive/20, border-destructive-400) are applied, regardless of validation state.

The path that does work

DatabasePasswordInput → DataInputs/Input → InputGroup. The DataInputs/Input component spreads {...props} (including aria-invalid merged by Slot) down to InputGroupInput, which forwards it to the <input data-slot="input-group-control">. Now a descendant has both data-slot and aria-invalid=true, so :has() fires correctly. This is the only pattern the fix actually works for.

How to fix

To support both patterns, add a parallel selector that matches when aria-invalid lands on the InputGroup's root element itself (i.e., [aria-invalid=true] as a direct attribute selector alongside the existing :has() variant), or propagate aria-invalid down to the inner <input> within InputGroupInput when rendering inside a FormControl context.


// Error state.
'has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 The PR replaces border-destructive (53.9% lightness in all themes) with border-destructive-400, which maps to only 20.6% lightness in dark mode—nearly invisible against dark backgrounds (~9–12% lightness). A dark: override for the border color is missing; the only dark-mode addition (dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40) only sets the ring color variable but the ring-width is only applied on focus-visible, so in the unfocused invalid state the near-invisible border is the sole error indicator. Add dark:has-[[data-slot][aria-invalid=true]]:border-destructive to restore the high-contrast 53.9% lightness border in dark mode.

Extended reasoning...

What the bug is and how it manifests

The PR changes the invalid-state border class from border-destructive to border-destructive-400 in input-group.tsx. In light mode this is appropriate—--destructive-400 has 91% lightness (light pink), matching other form fields. But in dark mode, --destructive-400 resolves to 6.7deg 60% 20.6% (a very dark brownish-red), while dark-mode panel/page backgrounds sit at approximately 8–12% lightness. The resulting contrast ratio (~1.2–1.5:1) is well below the WCAG 3:1 threshold for non-text UI elements, making the error border practically invisible.

The specific code path that triggers it

The changed line is in the error-state class string of InputGroup (line 30):

'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40'

The only dark-mode override added is dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40. This sets --tw-ring-color but does not apply a ring width—ring-2 is only present in the focus-visible rule. Consequently, in the unfocused invalid state the ring renders with zero width (no box-shadow), and the only visual indicator is the border at 20.6% lightness plus bg-destructive-200 at 9.2% lightness—both near-invisible.

Why existing code doesn't prevent it

input.tsx follows the same border-destructive-400 pattern but compensates with explicit focus overrides:
aria-[invalid=true]:focus:border-destructive aria-[invalid=true]:focus-visible:border-destructive
These restore the full-contrast 53.9% lightness border when the input is focused. input-group.tsx has no equivalent—its focus state adds a ring-background-control ring (not a destructive-colored border), so the error border stays at 20.6% in both focused and unfocused states in dark mode.

Impact

Any dark-mode user interacting with an invalid grouped input (e.g., the project-creation database password field) will see little to no red border error indication. This is a direct regression: before the PR, the border-destructive token provided 53.9% lightness in all themes.

Step-by-step proof

  1. Switch to dark mode (background lightness ~10%).
  2. Render an InputGroup containing an InputGroupInput with aria-invalid="true".
  3. The wrapper div receives Tailwind class border-destructive-400, which resolves via --destructive-400: 6.7deg 60% 20.6% (from dark.css) to a very dark brownish-red border.
  4. Background is ~10% lightness; border is 20.6% lightness → contrast ratio ≈ 1.3:1.
  5. The ring override only sets --tw-ring-color; without a ring-2 on the invalid (non-focused) state, no box-shadow renders.
  6. Result: no visible ring, near-invisible border—error state is undetectable.

How to fix

Add a dark-mode border override alongside the existing ring override:

- 'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40'
+ 'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40'

border-destructive maps to --destructive-default: 10.2deg 77.9% 53.9% in all themes, providing a clearly visible red border in dark mode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attempted fix adds has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus-visible]:border-destructive, which restores the high-contrast border-destructive token when the input is focused and invalid (in both light and dark mode). However, the original concern was specifically the unfocused invalid state in dark mode: border-destructive-400 at 20.6% lightness remains the sole border indicator there, and the requested dark:has-[[data-slot][aria-invalid=true]]:border-destructive override is still absent.

The current error-state line is:

'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
'has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus-visible]:border-destructive',

In dark mode without focus:

  • border-destructive-400 → 20.6% lightness (dark brownish-red, ~1.3:1 contrast against dark backgrounds)
  • The ring-destructive/40 override only sets --tw-ring-color; without ring-2 on the unfocused invalid state, no ring renders
  • Result: error border is still nearly invisible

To fix the unfocused dark-mode case, add dark:has-[[data-slot][aria-invalid=true]]:border-destructive alongside the existing ring override:

- 'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
+ 'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',

border-destructive maps to --destructive-default: 10.2deg 77.9% 53.9% in all themes, providing a clearly visible red border in the unfocused invalid state in dark mode.

@dnywh
dnywh requested a review from a team as a code owner April 9, 2026 03:41
@dnywh dnywh changed the title fix:(ui): invalid light mode styling for grouped inputs fix: use plain input for project creation password error state Apr 9, 2026
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  185 passed
flaky  3 flaky
skipped  4 skipped

Details

stats  192 tests across 21 suites
duration  8 minutes, 49 seconds
commit  8801680

Flaky tests

Features › database-webhooks.spec.ts › Database Webhooks › preserves webhook URL path and custom headers after editing
Features › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › broadcast modal validates JSON payload
Features › sql-editor.spec.ts › SQL Editor › should check if SQL editor is working as expected

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@dnywh dnywh changed the title fix: use plain input for project creation password error state fix: clean up grouped input border rendering Apr 9, 2026
<InputGroupAddon
align="inline-end"
// Override defaults
className="pr-1 has-[>button]:mr-0 has-[>kbd]:mr-0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem] on the underlying component? I don’t think it’s realistic that consumers will remember to pass these overrides each time. Maybe there’s a better way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be okay if people are just importing this ui-patterns version.


// Error state.
'has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 The PR adds has-[[data-slot][aria-invalid=true]]:bg-destructive-200 to the error state, but --destructive-200 resolves to only 9.2% lightness in dark mode — at or below dark backgrounds (~10–12% lightness) — making the background completely invisible (contrast ≈ 1:1). Combined with the already near-invisible border-destructive-400 at 20.6% lightness (~1.3:1 contrast) and a ring override that sets color without width (no box-shadow renders in unfocused state), the unfocused error state in dark mode has zero visually distinguishable indicators. Fix by adding dark:has-[[data-slot][aria-invalid=true]]:bg-transparent alongside the existing dark ring override so the error background reverts to transparent in dark mode.

Extended reasoning...

Bug: bg-destructive-200 is near-invisible in dark mode

What the bug is and how it manifests

The PR introduces has-[[data-slot][aria-invalid=true]]:bg-destructive-200 as part of the new error-state styling for InputGroup. In light mode, --destructive-200 resolves to 0deg 100% 99.4% (near-white light pink) — clearly visible against standard backgrounds. In dark mode, however, --destructive-200 resolves to 10.9deg 23.4% 9.2% lightness (confirmed from dark.css). Dark mode backgrounds sit at approximately 9–12% lightness (--background-200: 9%, --background-surface-75: 9%, --background-surface-100: 12.2%). The bg-destructive-200 at 9.2% lightness is at or below the page background lightness, making it completely invisible or even producing negative contrast.

The specific code path that triggers it

Line 30 of input-group.tsx (the changed line):

'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40'

The only dark-mode override added is dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40, which sets --tw-ring-color but does not apply a ring width — ring-2 is only present in the focus-visible rule. In the unfocused invalid state, no box-shadow renders, leaving only the border and background as visual indicators.

Why existing code doesn't prevent it

No dark: override was added for the background. The bg-destructive-200 class applies in all color modes, and the dark-mode CSS variable value for --destructive-200 happens to be darker than or equal to the page background. Light mode (99.4%) and dark mode (9.2%) values are polar opposites, yet the same Tailwind class is applied unconditionally.

What the impact would be

When combined with the separately noted near-invisible border-destructive-400 at 20.6% lightness (~1.3:1 contrast ratio against ~10% background), the unfocused error state in dark mode has NO visually distinguishable indicators whatsoever: neither the border nor the background meets any accessibility threshold. A dark-mode user who submits an invalid password and moves focus away from the field will see absolutely no error indication despite the field being marked aria-invalid=true.

Step-by-step proof

  1. Switch browser/OS to dark mode.
  2. Navigate to the project creation form.
  3. Fill in the database password field with an invalid value (or leave it blank) and submit.
  4. Move focus away from the field so the unfocused invalid state is active.
  5. The InputGroup wrapper receives bg-destructive-200 → resolves to hsl(10.9deg 23.4% 9.2%) — essentially identical to or darker than the dark-mode background (~10% lightness).
  6. border-destructive-400 → resolves to hsl(6.7deg 60% 20.6%) — contrast ratio ~1.3:1 against the background.
  7. The ring override sets color only, no ring-width → zero box-shadow.
  8. Result: the field looks identical to a valid field in dark mode; no error state is communicated visually.

How to fix

Add dark:has-[[data-slot][aria-invalid=true]]:bg-transparent alongside the existing dark ring override:

-'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
+'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:bg-transparent dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',

This reverts the background to transparent in dark mode while keeping the light-pink tint in light mode.

🔬 also observed by verify-runtime

Comment on lines 148 to +149
className={cn(
'flex-1 resize-none rounded-none border-0 bg-transparent py-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent',
'flex-1 resize-none rounded-none border border-transparent bg-transparent py-0 shadow-none',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 The PR changes both InputGroupInput and InputGroupTextarea from border-0 to border border-transparent, but only InputGroupInput received the compensating -m-px class. Without -m-px, the transparent 1px border on InputGroupTextarea takes layout space (box-sizing: border-box), sitting 1px inside the outer InputGroup border and creating a visible 1px gap filled by the group's background color (including bg-destructive-200 in error state). Add -m-px to InputGroupTextarea's class list to match InputGroupInput.

Extended reasoning...

What the bug is and how it manifests

The PR updates both inner grouped controls from border-0 to border border-transparent to give them stable border metrics. For InputGroupInput this is correct: the pre-existing -m-px (margin: -1px) extends the element 1px outward so its border overlaps and aligns with the outer InputGroup border. InputGroupTextarea receives the same border border-transparent change but does not receive -m-px, so it has no compensation for the space consumed by the new 1px transparent border.

The specific code path that triggers it

InputGroupInput (line ~134): 'flex-1 rounded-none border border-transparent -m-px bg-transparent shadow-none' — has -m-px.
InputGroupTextarea (line ~148): 'flex-1 resize-none rounded-none border border-transparent bg-transparent py-0 shadow-none' — missing -m-px.

Why existing code doesn't prevent it

In the old code, both components had border-0 (zero border-width), so -m-px was irrelevant for the textarea (no border space to compensate). InputGroupInput already had -m-px for other reasons and it was simply preserved when the PR updated the border. The PR author updated both to border border-transparent but only updated InputGroupInput's -m-px to be meaningful — the textarea's omission appears to be an oversight.

What the impact is

With box-sizing: border-box (Tailwind default), InputGroupTextarea sits 1px inside the outer InputGroup border on each side. This creates a 1px gap filled by the InputGroup's background (bg-foreground/[.026] normally, bg-destructive-200 in error state). In error state, this renders as a faint visible 'inner border' effect on the textarea that does not appear for InputGroupInput. The textarea content area is also 2px narrower and 2px shorter than an equivalent InputGroupInput.

Step-by-step proof

  1. Render an InputGroup containing an InputGroupTextarea with an InputGroupAddon (as in the design-system form-patterns example).
  2. Inspect the textarea element: it has border border-transparent but no -m-px.
  3. With box-sizing: border-box, the 1px border on each side shrinks the outer edge of the element 1px inward from the InputGroup container's inner edge.
  4. A 1px strip of the InputGroup's background is now visible between the InputGroup border and the textarea edge.
  5. Trigger an error state (aria-invalid=true on a descendant): the InputGroup gets bg-destructive-200, making the 1px gap distinctly visible as a faint red inner border ring on the textarea — absent on InputGroupInput.
  6. Fix: add -m-px to InputGroupTextarea's class list to match InputGroupInput.

// Error state.
'has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
'has-[[data-slot][aria-invalid=true]]:bg-destructive-200 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive-400 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40',
'has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus-visible]:border-destructive',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 The focused+invalid border upgrade on line 31 uses only :focus-visible, so mouse-clicking into an invalid grouped input keeps the border at border-destructive-400 instead of upgrading to border-destructive. By contrast, input.tsx applies the upgrade on both :focus and :focus-visible; the PR description says 'focused error border uses destructive' without qualifying keyboard-only, suggesting this is unintentional.

Extended reasoning...

What the bug is and how it manifests

The PR adds has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus-visible]:border-destructive (line 31) to upgrade the error border from border-destructive-400 to border-destructive when an invalid grouped input is focused. This selector only fires on :focus-visible (keyboard/tab navigation). Mouse-clicking into the field does not trigger :focus-visible, so the border stays at the lighter border-destructive-400 value. Keyboard users who tab into the field see the full-strength border-destructive upgrade; mouse users do not.

The specific code path that triggers it

input-group.tsx:31 — the error+focused selector is has-[[data-slot=input-group-control]:focus-visible], not has-[[data-slot=input-group-control]:focus]. Compare with input.tsx:16 which uses both aria-[invalid=true]:focus:border-destructive and aria-[invalid=true]:focus-visible:border-destructive to cover both interaction modes.

Why existing code does not prevent it

The refutation correctly notes that InputGroup's entire focus-state mechanism (line 27's ring styles) also uses :focus-visible only, so there is internal consistency within InputGroup. However, this internal consistency is in tension with input.tsx, which deliberately handles both :focus and :focus-visible for the same semantic state (invalid+focused border upgrade). The PR description states 'focused error border uses destructive' without qualifying keyboard-only, indicating the intent was broader coverage.

What the impact would be

A user who mouse-clicks into an invalid grouped input (e.g., the database password field after a validation error) sees the lighter border-destructive-400 border instead of the stronger border-destructive signal. The error state remains visible via the background and base border, so this is minor rather than a complete loss of feedback — hence nit severity.

Step-by-step proof

  1. Render a grouped input with aria-invalid=true (e.g., the database password field after form submission).
  2. The outer InputGroup div gets class border-destructive-400 from has-[[data-slot][aria-invalid=true]]:border-destructive-400.
  3. Mouse-click into the input. The inner input element receives CSS :focus but NOT :focus-visible (Chrome omits focus-visible for pointer interactions by default).
  4. The selector has-[[data-slot=input-group-control]:focus-visible]:border-destructive does not match — border stays at border-destructive-400.
  5. Tab into the same input instead. Now :focus-visible fires, the selector matches, and the border upgrades to border-destructive.
  6. Fix: add a parallel :focus variant — has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus]:border-destructive — matching the dual approach in input.tsx.

@dnywh
dnywh merged commit 0005d37 into master Apr 10, 2026
28 of 29 checks passed
@dnywh
dnywh deleted the dnywh/fix/fe-2959 branch April 10, 2026 02:03
@github-actions

github-actions Bot commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1775786701)

Score Average Improvements Regressions
Completeness 98% (-2pp) - 1 🔴
Conciseness 23.5% (-2pp) 2 🟢 3 🔴
Docs Faithfulness 73.2% (+0pp) 1 🟢 3 🔴
Goal Completion 94.1% (+2pp) 2 🟢 1 🔴
Knowledge Usage 100% (+0pp) - -
Correctness 87.5% (-12pp) - 2 🔴
Tool Usage 73.8% (+0pp) - -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
URL Validity 100% (+33pp) 1 🟢 -
Time_to_first_token 0.01tok (0tok) 11 🟢 6 🔴
Llm_calls 12.86 (+0.39) 10 🟢 3 🔴
Tool_calls 3.43 (+0.02) 6 🟢 8 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 24544.37tok (+397.04tok) 9 🟢 8 🔴
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 633.37tok (-43.12tok) 13 🟢 4 🔴
Completion_reasoning_tokens 0tok (+0tok) - -
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 25177.75tok (+353.92tok) 9 🟢 8 🔴
Estimated_cost 0.01$ (+0$) 6 🟢 6 🔴
Duration 16.91s (+0.98s) 9 🟢 8 🔴
Llm_duration 42.57s (+3.24s) 8 🟢 9 🔴

ignaciodob pushed a commit that referenced this pull request Apr 11, 2026
## What kind of change does this PR introduce?

Bug fix. Resolves FE-2959.

## What is the current behaviour?

Grouped inputs strip the inner control border with `border-0`, while the
outer `InputGroup` is responsible for the visible outline. After #44703,
grouped form inputs now receive the correct validation attributes, but
the primitive still removes the inner border dimensions entirely. That
keeps the visual layer brittle and can lead to inconsistent error
rendering, especially in light mode where the grouped password field
does not match the Project name input.

The shared `ui-patterns` input wrapper also inherits the generic
`inline-end` button spacing from `InputGroupAddon`, which pushes the
password copy button slightly too far to the right.

## What is the new behaviour?

The shared grouped-input primitive now keeps a transparent inner border
instead of removing border widths entirely. The outer `InputGroup`
continues to own the visible border, focus ring and error treatment, but
the inner control now has stable border metrics and no redundant
dark-mode background override.

The grouped invalid state now also matches the plain input treatment
more closely:

- unfocused error border uses `destructive-400`
- focused error border uses `destructive`
- error background uses `destructive-200`

The `ui-patterns` input wrapper now overrides the inherited `inline-end`
negative margin for its own copy/reveal button addon, so the password
copy button sits in the right place without changing spacing for other
direct `InputGroup` consumers.

| Before | After |
| --- | --- |
| <img width="1338" height="284" alt="CleanShot 2026-04-09 at 13 43
50@2x-91489355-5EEA-4884-BAA2-B93B28F1D7CB"
src="https://github.com/user-attachments/assets/ed40683b-8a87-4deb-8a0f-f892d00894f0"
/>| <img width="1334" height="278" alt="CleanShot 2026-04-09 at 13 41
36@2x-5D7E930B-EDB2-4002-9367-34ACE2DF4DB4"
src="https://github.com/user-attachments/assets/7d9594a4-9988-480e-a809-9f5ed29e8e24"
/> |
| <img width="1336" height="210" alt="CleanShot 2026-04-09 at 14 06
15@2x-05379F74-4CA5-4E6E-9250-CBA2764C1318"
src="https://github.com/user-attachments/assets/25e48cd4-de0a-47f3-9022-d7a3829a0626"
/> | <img width="1334" height="210" alt="CleanShot 2026-04-09 at 14 12
11@2x-11FBC519-D398-4A59-971A-97FBFEF610DE"
src="https://github.com/user-attachments/assets/91c3710c-7773-4286-854d-7b7144db85ab"
/> |

An easy place to test this is the Database password field in the New
Project creation flow. See also the Minimum password length field in
Email (Sign In / Providers).

## Summary

- update `packages/ui/src/components/shadcn/ui/input-group.tsx`
- replace `border-0` on grouped inputs/textareas with transparent
borders
- remove the redundant `dark:bg-transparent`
- keep the inner grouped controls visually neutral so the outer group
owns the rendered border state
- align grouped invalid border and background styling with the plain
input treatment
- update `packages/ui-patterns/src/DataInputs/Input.tsx` so copy/reveal
buttons do not inherit the extra right pull intended for other
`inline-end` addons
dnywh added a commit that referenced this pull request Sep 24, 2026
## Problem

- Grouped textareas render text too close to the top border. The
standalone `Textarea` retains its normal top padding.
- `InputGroupTextarea` has overridden the inner textarea with `py-0`
since #44282 on 31 March 2026. The group initially supplied `py-2`;
#44387 removed that outer padding later the same day, leaving no top
spacing. The override was retained during the border and surface updates
in #44690 and #48887.
- The textarea component page had no grouped textarea example, so this
difference was easy to miss.

## Solution

- Give the grouped textarea `pt-2` while retaining `pb-0` for block-end
addons. The outer group continues to own its border and focus styles.
- Add a “With addon” example to the textarea component page to keep this
composition visible.

## Review instructions

- Open `/design-system/docs/components/textarea` and find “With addon”.
Confirm its text has the same top inset as the default textarea and the
block-end addon remains below the input.
- Open `/design-system/docs/ui-patterns/forms` and find “Textarea
Multi-line text input for longer content with addon”. Confirm the text
has the same top inset as the standalone textarea example immediately
above it.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a textarea example with a supporting addon below the text field,
showing a 120-character limit.
* **Bug Fixes**
* Clicking a block-end addon now focuses its textarea as well as an
input.
* **Documentation**
* Added the textarea-with-addon example to the textarea component
documentation.
* **Style**
* Added top padding to textareas within input groups while keeping
bottom padding unchanged, adjusting spacing above entered text.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
joshenlim pushed a commit that referenced this pull request Sep 25, 2026
## Problem

- Grouped textareas render text too close to the top border. The
standalone `Textarea` retains its normal top padding.
- `InputGroupTextarea` has overridden the inner textarea with `py-0`
since #44282 on 31 March 2026. The group initially supplied `py-2`;
#44387 removed that outer padding later the same day, leaving no top
spacing. The override was retained during the border and surface updates
in #44690 and #48887.
- The textarea component page had no grouped textarea example, so this
difference was easy to miss.

## Solution

- Give the grouped textarea `pt-2` while retaining `pb-0` for block-end
addons. The outer group continues to own its border and focus styles.
- Add a “With addon” example to the textarea component page to keep this
composition visible.

## Review instructions

- Open `/design-system/docs/components/textarea` and find “With addon”.
Confirm its text has the same top inset as the default textarea and the
block-end addon remains below the input.
- Open `/design-system/docs/ui-patterns/forms` and find “Textarea
Multi-line text input for longer content with addon”. Confirm the text
has the same top inset as the standalone textarea example immediately
above it.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a textarea example with a supporting addon below the text field,
showing a 120-character limit.
* **Bug Fixes**
* Clicking a block-end addon now focuses its textarea as well as an
input.
* **Documentation**
* Added the textarea-with-addon example to the textarea component
documentation.
* **Style**
* Added top padding to textareas within input groups while keeping
bottom padding unchanged, adjusting spacing above entered text.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants