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.

No overlay with Drawer

See original GitHub issue

I’m trying to use the Drawer component, it works, but without the Overlay.

I’m using it in a very simple component.

class AppMenu extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      isOpen: true,
    };

    this.handleCloseDrawer = this.handleCloseDrawer.bind(this);
  }

  handleCloseDrawer() {
    this.setState({
      isOpen: false,
    });
  }

  render() {
    const { isOpen } = this.state;

    return (
      <div>
        <Drawer
          anchor="left"
          open={this.state.isOpen}
          onClose={this.handleCloseDrawer}
          variant="persistent"
        >
          <div
            tabIndex={0}
            role="button"
            onClick={this.handleCloseDrawer}
            onKeyDown={this.handleCloseDrawer}
          >
            <MenuItem>Menu Item</MenuItem>
          </div>
        </Drawer>
      </div>
    );
  }
}
  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

The Drawer, when open, should render a div tag to display an overlay which can be clicked to close the Drawer.

Current Behavior

The menu is created, without an overlay, so I can’t close the menu by clicking outside of it.

Steps to Reproduce (for bugs)

Very simple usage: https://codesandbox.io/s/n51myz595l

Context

I’m trying to have a Drawer like the demos.

Your Environment

The bug are here and on my Mac High Sierra with Google chome: https://codesandbox.io/s/n51myz595l

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
leMaikcommented, Apr 12, 2018

You are using variant="persistent", which doesn’t have an overlay because it is persistent. If you want a temporary drawer with an overlay that can close, use variant="temporary" (the default value for variant).

3reactions
mbrookescommented, Apr 12, 2018

You’re not seeing an overlay because you’re using a persistent draw. Try removing the variant prop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No overlay with Drawer #10993 - mui/material-ui - GitHub
I'm trying to use the Drawer component, it works, but without the Overlay. I'm using it in a very simple component. class AppMenu...
Read more >
flutter - Drawer - No Overlay Widget found - Stack Overflow
I have a normal MaterialApp with Scaffold having an AppBar and Drawer .
Read more >
Pros and Cons: Inset vs Overlay Cabinets
Overlay cabinets can have a full or partial overlay. Full overlay doors and drawers cover the face frame of the cabinet completely.
Read more >
Full overlay cabinets - contractor says no - Houzz
Whether you go with inset or full overlay, the opening width is the same width. There is no difference. - You will NOT...
Read more >
Everything You Need to Know About Inset vs Overlay Cabinets
A full overlay means that the doors and drawers completely cover the cabinet frame. Technically, there is about a 3/8″ gap in between...
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