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

Horizontal scrollbar when sidebar is collapsed #868

Open
mauro-ni opened this issue Jun 17, 2020 · 8 comments
Open

Horizontal scrollbar when sidebar is collapsed #868

mauro-ni opened this issue Jun 17, 2020 · 8 comments
Labels
good first issue Good for newcomers

Comments

@mauro-ni
Copy link

@siriwatknp I'm using version 4.4.1 of mui-treasury/layout and I noticed that when the sidebar is collapsed (only icons are visible) then it is scrollable horizontally (in Windows you get the annoying scrollbar). This is due to the overflow property set to auto.

Version 3 of mui-treasury/layout doesn't have this bug, since overflow css property is set differently:

# MuiPaper inside MuiDrawer
overflow-y: auto;

# Second child of MuiPaper
overflow: hidden auto;

Many thanks.

Mauro

@Technologeek
Copy link

@siriwatknp Can I pick up this up as my first issue?

@siriwatknp
Copy link
Owner

@Technologeek thanks, you might want to look at DrawerSidebar.tsx.

@siriwatknp siriwatknp added the good first issue Good for newcomers label Jun 25, 2020
@Technologeek
Copy link

Cheers! Will create a PR soon!

@RITIKHARIANI
Copy link

@siriwatknp and @Technologeek
Has this issue been fixed yet?

@mauro-ni
Copy link
Author

@siriwatknp and @Technologeek
Will this bug be fixed in the near future? Many tahnks.

@dimyG
Copy link

dimyG commented Oct 6, 2020

A quick solution is to make the collapsed width a little bigger. For example using 74px instead of 64 solved the issue.

scheme.configureEdgeSidebar(builder => {
builder
     .create('main_sidebar', { anchor: 'left' })
     .registerTemporaryConfig('xs', {
      anchor: 'left',
      width: 'auto', 
    })
    .registerPermanentConfig('md', {
      width: 256, 
      collapsible: true,
      collapsedWidth: 74,
    });
});

@mauro-ni
Copy link
Author

mauro-ni commented Mar 3, 2021

There are 2 horizontal scrollbars, here are my workarounds:

  1. As suggested by @dimyG I modified collapsedWidth, setting it to 65 solve the problem
  2. I defined a style class and conditionally applied it to the
import clsx from 'clsx';

const useStyles = makeStyles((theme) => ({
  sidebarOverflowFix: {
    overflowX: 'hidden !important',
    overflowY: 'auto !important',
  },
}));

...

{({ state: { sidebar } }) => {
  return (
    ...
    <DrawerSidebar sidebarId="left_sidebar">
      <SidebarContent className={clsx(sidebar.left_sidebar.collapsed && classes.sidebarOverflowFix)}>
        <AppSidebar collapsed={sidebar.left_sidebar.collapsed} />
      </SidebarContent>
      <CollapseBtn>
        {({ collapsed, anchor }) =>
          collapsed ? <ArrowForwardIcon /> : <ArrowBackIcon />
        }
      </CollapseBtn>
    </DrawerSidebar>
    ...
  );
}}

...

@Avni1802
Copy link

Can i pick this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants