feat(Layout): add defaultHasDividers context for container-controlled dividers - #969
Merged
Merged
Conversation
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsDialog · View in Storybook
Layout · View in Storybook · 🆕 XDSLayoutDividerContext
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. XDSLayout - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
… dividers Containers like XDSDialog can now control whether their layout headers/footers show dividers by default, without each header/footer having to hardcode it. - XDSLayout accepts new `defaultHasDividers` prop, provided via context - XDSLayoutHeader/Footer read context when `hasDivider` is not explicitly set - Explicit `hasDivider` on header/footer always overrides the context - XDSDialogHeader no longer hardcodes hasDivider=true — inherits from layout - Dialog stories updated to use the context-driven default (no dividers)
cixzhang
force-pushed
the
navi/feat/container-default-dividers
branch
from
March 30, 2026 02:00
526cdb8 to
af35e57
Compare
…a CSS sibling selectors Instead of header/footer using negative margins to collapse spacing, content now collapses its own padding using stylex.when.ancestor(:has()) selectors that detect whether adjacent header/footer has a divider. This fixes scrollable layouts (e.g. dialogs without dividers) where content would scroll flush against header/footer text with no breathing room. Changes: - Header/Footer: add data-divider attribute when divider is active, remove collapseBottom/collapseTop negative margin styles - Content: use ancestor :has() selectors to zero out padding-block-start/end when adjacent header/footer lacks data-divider Co-authored-by: Navi <navi@navibot.dev>
…ectors The stylex.when.ancestor() API requires a marker class on the ancestor element. Without stylex.defaultMarker() on layoutInner, the generated CSS selectors (.x-default-marker:has(...)) had nothing to match against. Co-authored-by: Navi <navi@navibot.dev>
44 tasks
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
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.
Containers like XDSDialog can now control whether their layout headers/footers show dividers by default, without each header/footer having to hardcode it.
How it works
XDSLayoutaccepts a newdefaultHasDividersprop. When set, it provides the value viaXDSLayoutDividerContext.XDSLayoutHeaderandXDSLayoutFooterread from this context whenhasDivideris not explicitly passed.Resolution order: explicit
hasDividerprop → contextdefaultHasDividers→falseChanges
XDSLayoutDividerContext— React context for default divider statedefaultHasDividers?: boolean, provides via contexthasDivideris undefinedhasDivider=true; inherits from layout contexthasDividerfrom footers (now context-driven)API Convention
Follows
default+hasprefix pattern per API Conventions wiki:defaultHasDividers(likedefaultHasSelection,defaultIsOpen).Ref #840