Skip to content
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

[Dialog] Provide an escape hatch for displaying backdrops on nested dialogs #1477

Open
a-redbourbon opened this issue Feb 25, 2025 · 2 comments
Labels
component: dialog This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@a-redbourbon
Copy link

a-redbourbon commented Feb 25, 2025

Feature request

Summary

Currently nested dialogs hide their backdrop, which is a GREAT default. However, in certain situations we need to display the backdrop on the nested dialog, e.g. a dialog that is being fired from a Sidebar drawer.

Something like forceNestedBackdrop should be declarative enough to get this working.

Motivation

I need to fire a nested dialog from within a sidebar drawer (currently built with the Dialog primitive) - the drawer doesn't have its own backdrop, and the nested dialog needs it to be presented correctly. Both dialogs have different shapes so sharing backdrop settings from the parent is not possible.

Image

Current Backdrop design forcefully hides the overlay when nested and there is no way to easily opt out of this behavior, so there is no easy way to position an overlay without working around nesting and breaking composition.

@a-redbourbon a-redbourbon added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 25, 2025
@mj12albert mj12albert changed the title [Dialog] Provide a scape hatch for displaying backdrops on nested dialogs [Dialog] Provide an escape hatch for displaying backdrops on nested dialogs Feb 25, 2025
@mj12albert mj12albert added the component: dialog This is the name of the generic UI component, not the React module! label Feb 25, 2025
@mj12albert
Copy link
Member

mj12albert commented Feb 25, 2025

// no need to render nested backdrops
const shouldRender = !nested;
if (!shouldRender) {
  return null;
}

This is indeed very hard to work around 🤔

Perhaps we could render a nested backdrop if there isn't a higher backdrop present? That would avoid adding an extra prop, do you see any issues with this? @atomiks

We also have an open issue for a dedicated Drawer component with a ton of upvotes already which would also address this issue ~

@mj12albert mj12albert added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 25, 2025
@a-redbourbon
Copy link
Author

Yeah! It's a very forceful impl. I really love how elegant it is 😅 but it's a bit harsh for composition.

Another option to avoid a prop could be to allow the consumer to leave out the Backdrop part to opt out when nesting.

Perhaps we could render a nested backdrop if there isn't a higher backdrop present? That would avoid adding an extra prop, do you see any issues with this? @atomiks

This would cause similar problems no? What if the drawer has a backdrop... then we're left without a way to separate the nested one visually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

No branches or pull requests

2 participants