fix: Modal appearance props now apply to the dialog card#758
Open
adrienzheng-cb wants to merge 4 commits into
Open
fix: Modal appearance props now apply to the dialog card#758adrienzheng-cb wants to merge 4 commits into
adrienzheng-cb wants to merge 4 commits into
Conversation
Box appearance props (borderRadius, background, padding, elevation, borders, etc.) were spread onto the full-viewport backdrop container instead of the visible dialog, making them no-ops (CDS-2213). They now forward to the dialog card on web and the surface on mobile. Also adds a styles/classNames slot API: web exposes `root` (backdrop container) and `dialog` (card) selectors; mobile exposes `dialog` and `content` style slots. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
🟡 Heimdall Review Status
🟡
|
| Code Owner | Status | Calculation | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ui-systems-eng-team |
🟡
0/1
|
Denominator calculation
|
Contributor
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed? Why?
Closes CDS-2213.
Modalinherits the fullBoxprop surface, but every extra prop was spread ontoModalWrapper's full-viewport backdrop container rather than the visible dialog. As a result, appearance props such asborderRadius,background,padding,elevation, and borders were applied to an invisible full-screen element and had no visual effect.This PR does two things:
Bugfix — route appearance/sizing props to the dialog. A curated set of card-appearance props (
borderRadius+ corners,background,color,borderColor/borderWidth+ sides,bordered*,elevation,padding*) now forwards to the visible dialog card (the innerVStack), and card-sizing props (minWidth/minHeight/maxHeight) forward to the sizing shell — extending the pattern already used forwidth/maxWidth. Container/positioning/behavior props (alignItems,justifyContent,position,pin,hideOverlay,role,zIndex,className,style, …) still target the backdrop container, so those remain unchanged. The previously hardcodedborderRadius={200}andelevation={2}become defaults. The same class of bug exists on mobile (props were swallowed by React Native'sModal); those props now forward to the modal surface.New
styles/classNamesslot API. Web addsmodalClassNamesandStylesAndClassNameswith selectorsroot(backdrop container) andsurface(card). Mobile adds astylesslot withsurfaceandcontent(safe-area region). This gives consumers explicit, unambiguous control going forward.Root cause (required for bugfixes)
Modalhas two boxes: the full-viewport backdrop/positioning container (ModalWrapper) and the visible rounded dialog card (the innerVStack, whose radius was hardcoded to200). All non-explicitly-destructured props were spread onto the backdrop container via{...props}, so appearance props likeborderRadiuslanded on the wrong (and invisible) element instead of the card.UI changes
No change to default appearance. Behavior change only affects consumers who pass appearance props (e.g.
borderRadius) — those now visibly apply to the dialog instead of silently doing nothing.borderRadiuswas a no-opborderRadiusapplies to the dialog cardFollow-up
This PR is intentionally non-breaking:
ModalPropsstill inherits the fullBoxPropssurface, so props that aren't meaningful on the backdrop container remain accepted (and mostly inert). Tightening that surface to an intentionalPick(and routing the few real-world escape-hatch props —visibility,display,overflow— throughstyles.rootvia a migrator codemod) is tracked as a v10 breaking change in CDS-2216.Testing
How has it been tested?
Testing instructions
yarn nx run web:test --testPathPattern="overlays/modal/__tests__/Modal.test.tsx"(added tests for static class names,classNamesslot,stylesslot, and that appearance styles land on the dialog and not the root).yarn nx run mobile:test --testPathPattern="overlays/modal/__tests__/Modal.test.tsx"(added a test that thesurfacestyles slot reaches the surface).yarn nx run web:typecheckandyarn nx run mobile:typecheck.Note: the mobile Modal is full-screen, so
borderRadiuson the surface is not visually meaningful there — the prop now applies rather than being dropped, andbackground/padding/stylesare the useful knobs.Change management
type=routine
risk=low
impact=sev5
automerge=false
Made with Cursor