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

Clipped Drawer Example Overflow Bug #20366

Closed
2 tasks done
bshin19 opened this issue Apr 1, 2020 · 1 comment · Fixed by #20396
Closed
2 tasks done

Clipped Drawer Example Overflow Bug #20366

bshin19 opened this issue Apr 1, 2020 · 1 comment · Fixed by #20396
Labels
component: drawer This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@bshin19
Copy link

bshin19 commented Apr 1, 2020

In the clipped drawer example, the top of the scroll bar is clipped beneath the header when it overflows (as the example does). An extra child element is added to the top to prevent this from causing content to be hidden beneath the header, but that still leaves the scroll bar flowing beneath the header.

  • 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 😯

When drawer content overflows, the scroll bar continues beneath the header and is not fully visible.

Expected Behavior 🤔

The scroll bar appears in it's entirety beneath the header when drawer content overflows in this example.

Steps to Reproduce 🕹

https://material-ui.com/components/drawers/

Scroll to 'clipped under the app bar' and look at it. Optionally add display: none to the app bar to see the rest of the scroll bar that's cut off currently.

Context 🔦

I believe these examples should provide best practices and be as close to ready out of the box as possible. The cut off scroll bar looks visually unappealing.

Your Environment 🌎

Tech Version
Material-UI v4.?.?
Browser chrome, firefox
@oliviertassinari oliviertassinari added component: drawer This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation good first issue Great for first contributions. Enable to learn the contribution process. labels Apr 1, 2020
@oliviertassinari
Copy link
Member

@bshin19 What do you think of this patch? Do you want to submit a pull request? :)

diff --git a/docs/src/pages/components/drawers/ClippedDrawer.tsx b/docs/src/pages/components/drawers/ClippedDrawer.tsx
index 0b7d71428..62414adbd 100644
--- a/docs/src/pages/components/drawers/ClippedDrawer.tsx
+++ b/docs/src/pages/components/drawers/ClippedDrawer.tsx
@@ -30,12 +30,13 @@ const useStyles = makeStyles((theme: Theme) =>
     drawerPaper: {
       width: drawerWidth,
     },
+    drawerContainer: {
+      overflow: 'auto',
+    },
     content: {
       flexGrow: 1,
       padding: theme.spacing(3),
     },
-    // necessary for content to be below app bar
-    toolbar: theme.mixins.toolbar,
   }),
 );

@@ -59,27 +60,29 @@ export default function ClippedDrawer() {
           paper: classes.drawerPaper,
         }}
       >
-        <div className={classes.toolbar} />
-        <List>
-          {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => (
-            <ListItem button key={text}>
-              <ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon>
-              <ListItemText primary={text} />
-            </ListItem>
-          ))}
-        </List>
-        <Divider />
-        <List>
-          {['All mail', 'Trash', 'Spam'].map((text, index) => (
-            <ListItem button key={text}>
-              <ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon>
-              <ListItemText primary={text} />
-            </ListItem>
-          ))}
-        </List>
+        <Toolbar />
+        <div className={classes.drawerContainer}>
+          <List>
+            {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => (
+              <ListItem button key={text}>
+                <ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon>
+                <ListItemText primary={text} />
+              </ListItem>
+            ))}
+          </List>
+          <Divider />
+          <List>
+            {['All mail', 'Trash', 'Spam'].map((text, index) => (
+              <ListItem button key={text}>
+                <ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon>
+                <ListItemText primary={text} />
+              </ListItem>
+            ))}
+          </List>
+        </div>
       </Drawer>
       <main className={classes.content}>
-        <div className={classes.toolbar} />
+        <Toolbar />
         <Typography paragraph>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
           ut labore et dolore magna aliqua. Rhoncus dolor purus non enim praesent elementum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: drawer This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation 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