-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Bug]: Dialog doesn't replace backdrop, just overlaps it #33734
Comments
@philkuo, Thanks for pointing this out! Basically, this won't replace the slot element, but instead use it as <DialogSurface backdrop={<div>foobar</div>}> And this will completely replace the slot element: <DialogSurface backdrop={{ children: (_, props) => <div>foobar</div> }}> Please check out the slots dev docs for more usage examples: especially The prop description seems a bit confusing, so we should probably look at making it clearer. |
I get this error: Uncaught Error: @fluentui/react-motion: Invalid child element. Motion factories require a single child element to be passed. That element element should support ref forwarding i.e. it should be either an intrinsic element (e.g. div) or a component that uses React.forwardRef(). Using this code: <DialogSurface
backdrop={
// <div aria-hidden className={cssStyles.overlay} />
{ children: (unused, props) => <div aria-hidden className={cssStyles.overlay} /> }
}
> I tried this as well but it had the same error: { children: (unused, p) => <div aria-hidden ref={p.ref} className={cssStyles.overlay} /> } |
Hey @philkuo, please check out your updated example here: https://stackblitz.com/edit/p154gpbz-2nikxz6e?file=src%2Fexample.tsx and let us know if you're still having any issues |
I tested the permutations of this. It seems there's no way to have a custom backdrop AND have the backdrop animated then (either via |
I also tried this with the props but it also did not work: |
The original issue was "Dialog doesn't replace backdrop, just overlaps it" and here's a working example https://stackblitz.com/edit/p154gpbz-8kkpf78t?file=src%2Fexample.tsx,src%2FApp.tsx. Is this not what you need? Are you looking for a way to customize the backdrop motion/animation? |
I do not need a custom animation, the default is fine. I do need a custom backdrop, but it must have an animation (default is fine). It seems it is impossible to have just the custom backdrop (without the default backdrop) AND an animation. |
Component
Dialog
Package version
9.5.12
React version
17.0.45
Environment
Current Behavior
<DialogSurface>
'sbackdrop
attribute is an element that gets appended as a child to the existing default dialog backdrop element.Expected Behavior
<DialogSurface>
'sbackdrop
element should REPLACE the default dialog backdrop element, not be a child of it.The documentation says this:
Reproduction
https://stackblitz.com/edit/p154gpbz-9uw2txdb?file=src%2Fexample.tsx
Steps to reproduce
The below code uses the
backdrop
attribute. Since it's unstyled and should be replacing the default backdrop, theoretically the background should not be dimmed at all when the dialog is open, but it is. You can see the foobar div as a child of the default backdrop instead of replacing it.The text was updated successfully, but these errors were encountered: