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

[Drawer] PaperProps className override base class #18714

Closed
2 tasks done
siriwatknp opened this issue Dec 7, 2019 · 1 comment · Fixed by #18740
Closed
2 tasks done

[Drawer] PaperProps className override base class #18714

siriwatknp opened this issue Dec 7, 2019 · 1 comment · Fixed by #18740
Labels
bug 🐛 Something doesn't work component: drawer This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@siriwatknp
Copy link
Member

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

forwarding className to PaperProps in Drawer remove className from Drawer.

Expected Behavior 🤔

className should append to Paper in Drawer

Steps to Reproduce 🕹

const App = () => {
  return (
    <Drawer
      PaperProps={{
        className: "my-class"
      }}
    >...</Drawer>
  )
}

Drawer will not be fixed anymore

Tech Version
Material-UI v4.7.0
React
Browser
TypeScript
etc.
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: drawer This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. labels Dec 7, 2019
@oliviertassinari
Copy link
Member

@siriwatknp Thanks for the bug report. I can confirm the issue. What do you think of this diff?

diff --git a/packages/material-ui/src/Drawer/Drawer.js b/packages/material-ui/src/Drawer/Drawer.js
index 4ac3496e1..1bd5ee5b1 100644
--- a/packages/material-ui/src/Drawer/Drawer.js
+++ b/packages/material-ui/src/Drawer/Drawer.js
@@ -113,7 +113,7 @@ const Drawer = React.forwardRef(function Drawer(props, ref) {
     ModalProps: { BackdropProps: BackdropPropsProp, ...ModalProps } = {},
     onClose,
     open = false,
-    PaperProps,
+    PaperProps = {},
     SlideProps,
     transitionDuration = defaultTransitionDuration,
     variant = 'temporary',
@@ -134,10 +134,15 @@ const Drawer = React.forwardRef(function Drawer(props, ref) {
     <Paper
       elevation={variant === 'temporary' ? elevation : 0}
       square
-      className={clsx(classes.paper, classes[`paperAnchor${capitalize(anchor)}`], {
-        [classes[`paperAnchorDocked${capitalize(anchor)}`]]: variant !== 'temporary',
-      })}
       {...PaperProps}
+      className={clsx(
+        classes.paper,
+        classes[`paperAnchor${capitalize(anchor)}`],
+        {
+          [classes[`paperAnchorDocked${capitalize(anchor)}`]]: variant !== 'temporary',
+        },
+        PaperProps.className,
+      )}
     >
       {children}
     </Paper>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: drawer This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants