fix(Dialog): reset inherited edge signals from ancestor containers - #1237
Merged
Conversation
…gin shift When XDSDialog is rendered inside a container that sets edge signals (e.g. TopNav's endContent sets --edge-end: 1), ghost buttons inside the dialog (like the close button) inherit the signal and apply unwanted edge compensation margins. CSS custom properties inherit through the DOM tree even for top-layer elements. Reset --edge-start and --edge-end to 0 on the <dialog> element so edge compensation only applies within intentional container boundaries.
Collaborator
Author
|
Not sure if we have a better way to reset these? LMK |
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsDialog · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Contributor
|
Hmm I was thinking to get rid of this kind of edge compensation and then just have the containers that want it adjust the negative margins around the content. But I guess it's tricky for the top nav. That might be the last one I need to think about converting. |
cixzhang
approved these changes
Apr 10, 2026
cixzhang
left a comment
Contributor
There was a problem hiding this comment.
In the meantime, this is a reasonable fix to unblock.
cixzhang
pushed a commit
that referenced
this pull request
Apr 26, 2026
…gin shift (#1237) When XDSDialog is rendered inside a container that sets edge signals (e.g. TopNav's endContent sets --edge-end: 1), ghost buttons inside the dialog (like the close button) inherit the signal and apply unwanted edge compensation margins. CSS custom properties inherit through the DOM tree even for top-layer elements. Reset --edge-start and --edge-end to 0 on the <dialog> element so edge compensation only applies within intentional container boundaries. Co-authored-by: Andrey Goder <agoder@fb.com>
cixzhang
pushed a commit
that referenced
this pull request
Jun 21, 2026
…gin shift (#1237) When XDSDialog is rendered inside a container that sets edge signals (e.g. TopNav's endContent sets --edge-end: 1), ghost buttons inside the dialog (like the close button) inherit the signal and apply unwanted edge compensation margins. CSS custom properties inherit through the DOM tree even for top-layer elements. Reset --edge-start and --edge-end to 0 on the <dialog> element so edge compensation only applies within intentional container boundaries. Co-authored-by: Andrey Goder <agoder@fb.com>
cixzhang
pushed a commit
that referenced
this pull request
Jun 21, 2026
…gin shift (#1237) When XDSDialog is rendered inside a container that sets edge signals (e.g. TopNav's endContent sets --edge-end: 1), ghost buttons inside the dialog (like the close button) inherit the signal and apply unwanted edge compensation margins. CSS custom properties inherit through the DOM tree even for top-layer elements. Reset --edge-start and --edge-end to 0 on the <dialog> element so edge compensation only applies within intentional container boundaries. Co-authored-by: Andrey Goder <agoder@fb.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.
Summary
XDSDialogis rendered as a DOM descendant of a container that sets edge compensation signals (--edge-start/--edge-end), ghost-variant buttons inside the dialog (like the close button inXDSDialogHeader) incorrectly apply edge compensation negative margins. This happens because CSS custom properties inherit through the DOM tree even for top-layer elements rendered viashowModal().XDSTopNavsets--edge-end: 1on itsendContentwrapper viaedgeSignals.end. When a dialog is rendered insideendContent, the close button'sedgeCompensation.selfstyle reads the inherited--edge-end: 1and applies an unwanted-8pxmargin, making it visually different from dialogs rendered outside the TopNav.--edge-startand--edge-endto0on the<dialog>element so edge compensation only applies within intentional container boundaries.Repro scenario
The close button in the dialog has a visible margin shift compared to an identical dialog rendered outside the TopNav.
Test plan