question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drawer keep showing a horizontal scrollbar on opening. (Mini variant)

See original GitHub issue

Hi,

The Mini variant drawer from MUI is showing a bottom horizontal scrollbar while it’s transitioning from close to open, but not on the other way around (open to close).

The bug works on Chrome and Firefox. The official demo does have that bug too. https://material-ui.com/components/drawers/

Current Behavior 😯

Either on my SPA and the on official demo of the mini drawer, when you open the drawer, it will display a bottom horizontal scrollbar while opening. The scrollbar disappear once the transition from close to open is finished. It works on Chrome, Firefox and Edge.

Official demo : image

My SPA : image

Expected Behavior 🤔

It shouldn’t display a scrollbar while opening (the permanent variant doesn’t).

Steps to Reproduce 🕹

Use the official demo from MUI. It has the same bug. https://material-ui.com/components/drawers/

Steps:

  1. Go the to Mini-drawer variant.
  2. Click on the Drawer menu icon on the top left.
  3. The horizontal scrollbar is displayed while the drawer is opening.

Context 🔦

It’s annoying for the users since it’s slightly raising up the links at the bottom of the Mini-drawer which are placed with :

  MenuIconBottom: {
    position: 'absolute',
    bottom:0,
  },

Your Environment 🌎

On Windows with dotnet new react -o <output_directory_name> -au Individual

Tech Version
Material-UI v4.8.0
React 16.12.0
Browser Chrome, Firefox, Edge
.Net Core 3.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
r3dm1kecommented, Dec 19, 2019

Can confirm, it can be fixed with this diff:

index 1bd5ee5b1..acb03460b 100644
--- a/packages/material-ui/src/Drawer/Drawer.js
+++ b/packages/material-ui/src/Drawer/Drawer.js
@@ -20,6 +20,7 @@ export const styles = theme => ({
   /* Styles applied to the `Paper` component. */
   paper: {
     overflowY: 'auto',
+    overflowX: 'hidden',
     display: 'flex',
     flexDirection: 'column',
     height: '100%',

overflowX: 'hidden' is already being applied to the mini drawer, and I see no use case where a horizontal scroll bar will be required in a drawer

0reactions
AlvesJorgecommented, Jun 28, 2021

Hello, I can confirm now in 2021 it is still needed to add overflowX: “hidden” to the openedMixin theme to make the scrollbar disappear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drawer keep showing a horizontal scrollbar on opening. (Mini ...
Steps to Reproduce · Go the to Mini-drawer variant. · Click on the Drawer menu icon on the top left. · The horizontal...
Read more >
Material UI Drawer overflow causing scrollbar on body
You need to add height: 100% css property on some container components, and to styles to drawerPaper need add too. I have setup...
Read more >
overflow-x - CSS: Cascading Style Sheets - MDN Web Docs
Content is clipped if necessary to fit horizontally in the padding box. Browsers display scrollbars whether or not any content is actually ...
Read more >
Navigation drawer component — Vuetify
For the purpose of display, some examples are wrapped in a v-card element. ... Places the component in mini-variant mode and expands once ......
Read more >
Drawer API - Material UI - MUI
API reference docs for the React Drawer component. Learn about the props ... The props of the Modal component are available when variant="temporary"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found