-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(react-dialog): add appearance to backdrop slot #35692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(react-dialog): add appearance to backdrop slot #35692
Conversation
📊 Bundle size report
Unchanged fixtures
|
|
Pull request demo site: URL |
|
TBH, I'm not sure I understand the purpose of the @mainframev, have you considered adding a prop to prevent the backdrop from being transparent, even when the dialog is nested? This might be clearer than using |
79c1a81 to
946c759
Compare
946c759 to
be42731
Compare
be42731 to
8dd2d1a
Compare
Yeah, I agree that it was not very well thought through very well. I thought in the direction of adding a This would be a convenient prop that makes users lives easier, especially since we have already received several questions about this. Alternatively, we could approach this differently by exposing a data attribute on the backdrop slot, for example: backdrop={{ 'data-backdrop-appearance': 'dimmed' }}. This could help avoid potential confusion caused by having both backdrop and backdropAppearance props at the same time. |
2985d80 to
2d44af2
Compare
f5ce3f2 to
45c0108
Compare
da952d2 to
4f2ca66
Compare
dmytrokirpa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT, just two things to address and should be good to go:
- Clarify why do we need to remove the
appearanceprop from thebackdropslot - Could we add some tests (VR, e2e, etc) to test the old/new behavior?
...omponents/react-dialog/library/src/components/DialogSurface/useDialogSurfaceStyles.styles.ts
Show resolved
Hide resolved
...omponents/react-dialog/library/src/components/DialogSurface/useDialogSurfaceStyles.styles.ts
Outdated
Show resolved
Hide resolved
0a3fb6a to
a679925
Compare
...es/react-components/react-dialog/library/src/components/DialogSurface/DialogSurface.types.ts
Outdated
Show resolved
Hide resolved
a679925 to
435eb52
Compare
435eb52 to
d928a03
Compare

This pull request introduces a new
appearanceproperty to theDialogSurfacebackdropslot in@fluentui/react-dialog, enabling explicit control over the dialog's backdrop appearance. By default, the dialog automatically chooses between a dimmed or transparent backdrop based on its nesting context, but this change allows developers to override that behavior. The update includes type definitions, logic for resolving the backdrop appearance, style adjustments, documentation, and a new story demonstrating the feature.DialogBackdropSlotPropstype to support anappearanceprop ('dimmed'or'transparent') for the backdrop slot inDialogSurface.Previous Behavior
The dimmed background applied based on the Dialog context. Inside OverlayDrawer dialogs become nested and inner Dialog does not have dimmed background. The only way to apply the dimmed background for inner Dialog is via
backdropslot inDialogSurfaceNew Behavior
Can be controlled via
backdropAppearancewithout the need to use hack with passing custom styled backdrop toDialogSurfaceRelated Issue(s)
Related older discussion