Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

283
Views
Raise Header's Z-Index Over Material UI Modal Backdrop

I'm building a mobile version of a web app using Material UI and having trouble matching designs. I'm using MUI App-Bar together with MUI Modal to create something similar to the mockups shown below.

The expected behavior is that the user selects the button in the top right of the header to open the modal, and has the option to use the top right button again to close the modal. The user should also be able to select My App logo in the header to navigate to the home page.

The actual behavior is that the header bar is covered by the modal's backdrop; I can add styling like marginTop: 150px to the backdrop to visually achieve the expected result, but the button and the logo are still not usable.

Is there a way to override the backdrop component so that the header will be usable?

No Modal on left, Expected behavior in middle, actual on right

const useStyles = makeStyles((theme: Theme) => ({
  card: {
    position: "absolute",
    top: "160px",
    width: "90vw",
    borderTopLeftRadius: "0px",
    borderTopRightRadius: "0px",
  },
  backDrop: {
    marginTop: "160px",
  },
}));

const Header = (props) => {
  const classes = useStyles();

  const [menuOpen, setMenuOpen] = React.useState(false);

  const handleOpenUserMenu = () => {
    setMenuOpen(true);
  };

  const handleCloseUserMenu = () => {
    setMenuOpen(false);
  };

  return (
    <AppBar
      position="static"
      style={{
        backgroundColor: "#FFFFFF",
        zIndex: -1,
      }}
    >
      <Container maxWidth="xl">
        <Toolbar>
          <Box sx={{ flexGrow: 1 }}>
            <Link to={"/home"}>
              <Logo className={classes.logo} />
            </Link>
          </Box>
          <Box sx={{ flexGrow: 0 }}>
            <IconButton onClick={handleOpenUserMenu}>
              <MenuIcon />
            </IconButton>
            <Modal
              open={menuOpen}
              onClose={onClose}
              BackdropProps={{ classes: { root: classes.backDrop } }}
            >
              <Card className={classes.card}>
                <CardContent>
                  <MenuItems menuOptions={menuOptions} />
                </CardContent>
              </Card>
            </Modal>
          </Box>
        </Toolbar>
      </Container>
    </AppBar>
  );
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As stated in MUIModal documentation the modal component is supposed to behave like that I would try to use menu component instead

Quoting documentation:

If you are creating a modal dialog, you probably want to use the Dialog component rather than directly using Modal. Modal is a lower-level construct that is leveraged by the following components:

  • Dialog
  • Drawer
  • Menu <--
  • Popover
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!