-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Bug Description
FieldGroup content becomes invisible when viewport is resized if all three conditions are met:
FieldGroupis inside<fieldset>(Form/FieldSet component)FieldGroupuses@container/field-group(default behavior)- Another element inside the same
<fieldset>changes display mode on breakpoint (e.g.,grid sm:flex)
Content remains in DOM but is not displaid.
Live Reproduction
Live Demo on Vercel - resize browser to < 640px to see the bug
Open in StackBlitz (but its seems Turbopack still does not have a WebAssembly build currently)
When viewport resizes, the browser cannot properly recalculate container query context inside <fieldset> when another element changes its display mode (NOT SURE!!!)
Affected component/components
FieldSet, FieldGroup, Form
How to reproduce
- Open the live demo
- View in desktop viewport (> 640px)
- Resize browser window to < 640px
- Expected: Content remains visible
- Actual: Content disappears (still in DOM, check DevTools)
Minimal Code Example
import { FieldGroup, FieldSet } from "@/components/ui/field";
export default function Page() {
return (
<form>
<FieldSet>
<FieldGroup>
<p>This content will disappear on resize</p>
</FieldGroup>
<div className="grid sm:flex"></div>
</FieldSet>
</form>
);
}Key insight: Remove className="grid sm:flex" and the bug disappears.
Codesandbox/StackBlitz link
https://shadcn-ui-fieldgroup-issue.vercel.app/
Logs
System Info
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041
Available memory (MB): 24576
Available CPU cores: 12
Binaries:
Node: 22.15.0
npm: 10.9.2
Yarn: 1.22.22
pnpm: 10.10.0
Relevant Packages:
next: 16.0.9
eslint-config-next: N/A
react: 19.2.2
react-dom: 19.2.2
typescript: 5.9.3
Next.js Config:
output: N/ABefore submitting
- I've made research efforts and searched the documentation
- I've searched for existing issues
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working