Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…h auto-sizing - Update inferModalSize: 2 cols → 'xl', 3+ cols → 'full' (was lg/xl/full) - Update modalSizeClasses: 'xl' now maps to max-w-5xl (was max-w-4xl) - Remove hardcoded modalSize: 'lg' from Console App.tsx to let auto-layout control - Update autoLayout and MobileUX tests to match new size mappings Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 仔细分析问题的根源,目前在平板横屏模式下,还是只显示一列和截图效果一样。 |
…obileDialogContent's sm:max-w-lg Root cause: MobileDialogContent has hardcoded sm:max-w-lg in its base classes. ModalForm was passing bare max-w-5xl without sm: prefix, so tailwind-merge treated them as different variants and kept BOTH. On screens ≥640px (tablet/desktop), sm:max-w-lg (512px) always won → the modal stayed narrow regardless of auto-layout. Fix: Change all modalSizeClasses to use sm: prefix (e.g. sm:max-w-5xl) so tailwind-merge properly resolves the conflict (same variant = last wins). Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Found the root cause: Fixed in |
There was a problem hiding this comment.
Pull request overview
This PR fixes two related bugs that caused CRUD modal dialogs to render too narrow:
- Wrong size mapping:
inferModalSizewas mapping 2 columns to'lg'(max-w-2xl/ 672px) — now maps to'xl'(sm:max-w-5xl/ 1024px), and 3 columns collapses to'full'instead of'xl'. tailwind-mergevariant conflict:modalSizeClassesused baremax-w-*classes, butMobileDialogContenthardcodessm:max-w-lg. Without thesm:prefix,tailwind-mergetreated them as different responsive variants and kept both (the basesm:max-w-lgalways winning on tablet/desktop). Addingsm:prefix to all entries ensures the override is resolved correctly.- Hardcoded override removal:
App.tsxwas hardcodingmodalSize: 'lg', bypassing auto-layout entirely.
Changes:
- Updated
inferModalSizeto map 2 columns →'xl', 3+ columns →'full' - Updated
modalSizeClassesto usesm:prefix on all entries (e.g.sm:max-w-5xlfor'xl') - Removed
modalSize: 'lg'fromApp.tsxto let auto-layout control the size - Updated tests in
autoLayout.test.tsandMobileUX.test.tsxto match new mappings
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/plugin-form/src/autoLayout.ts |
Updates inferModalSize — simplifies to 3-level mapping (default/xl/full) |
packages/plugin-form/src/ModalForm.tsx |
Adds sm: prefix to all modalSizeClasses values; improves JSDoc comment |
apps/console/src/App.tsx |
Removes hardcoded modalSize: 'lg' so auto-layout drives modal width |
packages/plugin-form/src/__tests__/autoLayout.test.ts |
Updates test expectations to match new inferModalSize mapping |
packages/plugin-form/src/__tests__/MobileUX.test.tsx |
Updates test description and assertion from max-w-2xl to max-w-5xl |
CRUD dialogs with >3 fields render in a narrow single-column modal because
inferModalSizemapped 2 columns to'lg'(max-w-2xl / 672px) and Console hardcodedmodalSize: 'lg', bypassing auto-layout entirely. Additionally,MobileDialogContenthardcodessm:max-w-lgin its base classes, andmodalSizeClassesused baremax-w-*classes without thesm:prefix —tailwind-mergetreated these as different responsive variants and kept both, sosm:max-w-lg(512px) always won on tablet/desktop screens.Changes
autoLayout.ts—inferModalSize: 2 cols →'xl'(was'lg'), 3+ cols →'full'(was split across'xl'/'full')ModalForm.tsx—modalSizeClasses: all values now usesm:prefix (e.g.sm:max-w-5xl) sotailwind-mergecorrectly overridesMobileDialogContent's basesm:max-w-lg;'xl'maps tosm:max-w-5xl(1024px, wasmax-w-4xl/ 896px)App.tsx— RemovemodalSize: 'lg'so auto-layout controls width based on field countautoLayout.test.tsandMobileUX.test.tsxexpectations to match new mappingsEffective behavior
defaultxlfullExplicit
modalSize,columns, andsectionsin JSON schema still take priority over auto-layout. Container query responsive classes (@md:grid-cols-2) already handle mobile collapse — no changes needed there.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.