Skip to content

Conversation

@mainframev
Copy link
Contributor

@mainframev mainframev commented Jan 22, 2026

This pull request introduces a new appearance property to the DialogSurface backdrop slot 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.

  • Added DialogBackdropSlotProps type to support an appearance prop ('dimmed' or 'transparent') for the backdrop slot in DialogSurface.

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 backdrop slot in DialogSurface

before

New Behavior

Can be controlled via backdropAppearance without the need to use hack with passing custom styled backdrop to DialogSurface

after

Related Issue(s)

Related older discussion

@github-actions
Copy link

github-actions bot commented Jan 22, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.291 MB
323.024 kB
1.291 MB
323.084 kB
180 B
60 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
71.11 kB
20.219 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.741 kB
68.697 kB
react-components
react-components: FluentProvider & webLightTheme
44.409 kB
14.303 kB
react-dialog
Dialog (including children components)
102.964 kB
30.723 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
109.036 kB
36.023 kB
🤖 This report was generated against 83f780ca128cfe6c9ea35cc3f3b180e2eae1b60d

@github-actions
Copy link

Pull request demo site: URL

@@ -0,0 +1,7 @@
{
Copy link

@github-actions github-actions bot Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Dialog 16 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Dialog.dialog inside drawer default - Dark Mode.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer default - High Contrast.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer default - RTL.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer default.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer dimmed - Dark Mode.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer dimmed - High Contrast.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer dimmed - RTL.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer dimmed.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer transparent - Dark Mode.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer transparent - High Contrast.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer transparent - RTL.chromium.png 0 Added
vr-tests-react-components/Dialog.dialog inside drawer transparent.chromium.png 0 Added
vr-tests-react-components/Dialog.nested dialog dimmed - Dark Mode.chromium.png 0 Added
vr-tests-react-components/Dialog.nested dialog dimmed - High Contrast.chromium.png 0 Added
vr-tests-react-components/Dialog.nested dialog dimmed - RTL.chromium.png 0 Added
vr-tests-react-components/Dialog.nested dialog dimmed.chromium.png 0 Added
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 511 Changed
vr-tests-react-components/Positioning.Positioning end.chromium.png 611 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png 635 Changed
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled.chromium.png 677 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

@dmytrokirpa
Copy link
Contributor

dmytrokirpa commented Jan 22, 2026

TBH, I'm not sure I understand the purpose of the hasParentDialog={false} API, as its meaning isn't clear and it doesn't actually change the component's parent.

@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 hasParentDialog={false}, especially since there is a parent dialog present.

@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from 79c1a81 to 946c759 Compare January 22, 2026 16:45
@mainframev mainframev requested review from a team and marcosmoura as code owners January 22, 2026 16:45
@mainframev mainframev changed the title feat(react-dialog): add hasParentDialog prop feat(react-dialog): add backdropAppearance prop Jan 22, 2026
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from 946c759 to be42731 Compare January 22, 2026 16:47
@mainframev mainframev removed request for a team and marcosmoura January 22, 2026 16:48
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from be42731 to 8dd2d1a Compare January 22, 2026 16:50
@mainframev
Copy link
Contributor Author

mainframev commented Jan 22, 2026

TBH, I'm not sure I understand the purpose of the hasParentDialog={false} API, as its meaning isn't clear and it doesn't actually change the component's parent.

@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 hasParentDialog={false}, especially since there is a parent dialog present.

Yeah, I agree that it was not very well thought through very well. I thought in the direction of adding a backdropAppearance prop instead, I updated the suggestion, this should be more clear now with SB example and updated prop. Thank you :)

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.

@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch 3 times, most recently from 2985d80 to 2d44af2 Compare January 23, 2026 18:42
@mainframev mainframev changed the title feat(react-dialog): add backdropAppearance prop feat(react-dialog): extend backdrop slot Jan 23, 2026
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from f5ce3f2 to 45c0108 Compare January 23, 2026 18:49
@mainframev mainframev changed the title feat(react-dialog): extend backdrop slot feat(react-dialog): add appearance to backdrop slot Jan 23, 2026
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from da952d2 to 4f2ca66 Compare January 27, 2026 12:58
Copy link
Contributor

@dmytrokirpa dmytrokirpa left a 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 appearance prop from the backdrop slot
  • Could we add some tests (VR, e2e, etc) to test the old/new behavior?

backdrop.className,
);

if (backdrop?.appearance) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Contributor Author

@mainframev mainframev Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not fully sure about that, but this is needed in order to prevent appearance to be added to DOM element as attribute, I think something similar we have with Tree component. The utility we use to whitelist the attributes is gonna be removed according to your proposal, so I left this approach.

Could we add some tests (VR, e2e, etc) to test the old/new behavior?

👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, so we basically need to remove a custom prop from a 'div' slot before rendering.

The confusing part is that we're doing this in a "style" hook 😕

@mainframev mainframev requested a review from a team as a code owner January 28, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dialog nested inside Drawer renders transparent backdrop (background not dimmed)

2 participants