-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(Drawer): fix incorrect usage of the backdrop #3883
Conversation
ad7ff2f
to
34b5c53
Compare
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.
Nice 👌
There's something wrong with the docs though
34b5c53
to
30e9669
Compare
@zettca updated the PR with the recommended changes. Deprecated the |
30e9669
to
4099c8f
Compare
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.
Looks good 🙏
I noticed the following:
-
When clicking on the button in the last sample, the page scrolls to the top automatically and the drawer doesn't open. But this happens when we click anywhere on the screen. I don't really understand what's happening but putting everything in one sample helps. So we could add the global action and the button to open the drawer on the "Main" sample. For applitools, we can open the drawer programatically like we do with the dialog component.
-
disableBackdropClick
doesn't seem to be working. Suggestion:
const handleOnClose: MuiDrawerProps["onClose"] = (event, reason) => {
if (reason === "backdropClick" && disableBackdropClick) return;
onClose?.(event, reason);
};
return (
<MuiDrawer
(...)
slotProps={{
backdrop: {
(...),
onClick: (event) => handleOnClose(event, "backdropClick"),
},
}}
onClose={handleOnClose}
{...others}
>
<IconButton
id={setId(id, "close")}
className={classes.closeButton}
variant="secondaryGhost"
onClick={onClose}
title={buttonTitle}
>
<Close role="none" />
</IconButton>
{children}
</MuiDrawer>
);
4099c8f
to
db53eeb
Compare
@MEsteves22 updated the PR. I removed the second story and fixed the |
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.
👌🏻
I added a story to have a
Drawer
open on top of some content, namely theGlobalActions
that might have some styles clash with the one's on theDrawer
. I opted to leave that be checked by Storybook because it might be important to have that tested in case anything changes.