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
322.99 kB
1.292 MB
323.043 kB
167 B
53 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.224 kB
19.89 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.179 kB
68.482 kB
react-components
react-components: FluentProvider & webLightTheme
43.523 kB
13.978 kB
react-dialog
Dialog (including children components)
102.078 kB
30.379 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
108.15 kB
35.693 kB
🤖 This report was generated against 93f8af06be5ab06d974cf936a462d739a98231fb

@github-actions
Copy link

Pull request demo site: URL

@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?

@mainframev mainframev requested a review from a team as a code owner January 28, 2026 16:29
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from 0a3fb6a to a679925 Compare January 30, 2026 11:43
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from a679925 to 435eb52 Compare January 30, 2026 15:21
@mainframev mainframev force-pushed the fix/drawer-dialog-dimming-issue branch from 435eb52 to d928a03 Compare January 30, 2026 15:26
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