Accordion content from MUI gets cut off by bookmark bar when expanded

How can I prevent an MUI accordion in an appBar from moving up and hiding behind the browser's bookmark bar when expanded?

const useStyles = makeStyles((theme)) => {
    appBar: {
        borderBottom: "2px solid #D2D2D2",
        backgroundColor: "#fff",
        marginTop: "0px",
        height: "2.8vw",
    },
    appBarAcc: {
        // display: "flex", // Causes the accordion to expand horizontally
        flexDirection: "column",
        width: "auto",
        // padding: "0.8vw 0.4vw",
        "&:hover": {
            backgroundColor: "#B6B6B6",
        },
    },
}
...
                    <AppBar position="static" className={classes.appBar} elevation={0}>
                        <Toolbar variant="dense">
                            <Accordion className={classes.appBarAcc} elevation={0} TransitionProps={{ unmountOnExit: true }}>
                                <AccordionSummary expandIcon={<ExpandMoreIcon />}>
                                    <NotificationsNoneIcon
                                        style={{ color: "#636363", marginRight: "0.4vw", fontSize: "large", justifyContent: "center" }}
                                    />
                                    <Typography>Notifications</Typography>
                                </AccordionSummary>
                                <AccordionDetails>
                                    <Typography>No notifications</Typography>
                                </AccordionDetails>
                            </Accordion>
                        </Toolbar>
                    </AppBar>

Answer №1

The upward movement occurs because the element is nested within a parent Toolbar element that has a styling of flex and align-items: center.
To correct this, you will need to adjust the Toolbar's style to align-items: flex-start;

const newStyles = makeStyles((theme)) => {
   ...styles,
   toolbar: {
      alignItems: "flex-start"
  }
}

<Toolbar variant="dense" className={classes.toolbar}>
   {children}
</Toolbar>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can anyone explain how to conduct a live search using Ajax?

Hello, I'm currently working on a project where I've successfully connected a large database to a website and implemented an AJAX live search feature. However, I am now in need of a non-live version of the AJAX search. The current setup displays ...

Creating and updating a TypeScript definition file for my React component library built with TypeScript

As I work on developing a React library using TypeScript, it is important to me that consumers of the library have access to a TypeScript definition file. How can I ensure that the TypeScript definition file always accurately reflects and matches the Java ...

Dynamic value updates using jQuery input type formulas

I need help with a form that has two inputs: The first input allows the user to enter an amount, such as 1000. The second input is read-only and should display the value of the first input plus 1%. For example, if the user types in 1000 in the first fie ...

Bringing a JavaScript function into a TypeScript file results in it being treated as a namespace

Trying to bring a vanilla JavaScript function into a TypeScript file within a React Native app has presented some challenges. The import process goes smoothly when working with JS, but switching to TS triggers the error message: Cannot use namespace &apos ...

Having trouble getting React Router routing to play nice with both MUI Drawer and Redux Toolkit?

Having an issue with the Material UI component Drawer in conjunction with React Router and global state management using Redux Toolkit. The problem arises when clicking on NavLinks in the drawer, as it inconsistently changes routes. Sometimes it works fine ...

Nothing remains after the fall: coding void

I am facing an issue where my item becomes null after being dragged 2-3 times and dropped in a different place. I have included my code below and I can't seem to figure out where the mistake lies. Can you please review it and let me know what needs to ...

How can I reset the HomeStacks screen in React Expo every time I click a button?

I've encountered an issue while developing a mobile app using react expo. The menu in my app fetches a list of items, but it only retrieves the data on the initial click. Subsequent clicks do not refresh the data. useEffect(() => { getItemsLi ...

Troubleshooting: The issue of Vue JS not successfully navigating between web

After countless attempts, I am still struggling to get my Firebase login function to appropriately switch the component upon signing in. I urgently need assistance with configuring my router to seamlessly transition to the next page once the sign-in proces ...

Relay information between requests using a RESTful API and various data formats, such as JSON, XML, HTML

In a scenario with a REST API that can deliver JSON, XML, HTML, and other formats, the default response for browsers without JavaScript enabled is HTML. This API utilizes tokens for authentication and authorization. Within a traditional website project, t ...

Error message in Ionic 2: "Property is not found on type"

Currently, I am working on a project in Ionic 2 and have encountered a stumbling block with a seemingly simple task. My issue lies with a Textbox where I aim to input text that will then be displayed. I found some code on a website (http://www.tizag.com/j ...

Getting the result from HTML5 FileReader: How does it work?

Dealing with the asynchronous nature of JS FileReader can be challenging. I need to retrieve the result after reading a file and work with that data, but I don't know when the result will be ready. How can I handle this situation effectively? $(docum ...

Vue components fail to display properly when transitioning between routes in Vue (version 3) using the Vue Router

Just diving into VueJS version 3 and vue-router. Despite my efforts to troubleshoot by consulting Stack Overflow and Google, the issue remains unresolved. I have defined two routes: /login /admin/index The Problem: While the login route ...

Use multer-ftp to change the name of a file

I've been working on uploading a file to an FTP server using multer-ftp. The file is successfully uploaded, but I need to change the name of the file. Is there a way to accomplish this? var upload = multer({ storage: new FTPStorage({ basepath: ...

What are some creative ways to customize Material UI components?

My implementation of a TextField component looks like this: <TextField style={styles} className = "my-3" fullWidth id="filterBox" InputProps={{ endAdornment: <SearchIcon style={{color: "white" ...

"Attempting to troubleshoot a calculator built with html, css, and js. I'm stumped as to what could

After following a tutorial on YouTube, going over the code multiple times, and still experiencing issues with the calculator. Sometimes it works fine, other times certain buttons like (+, -, x, ⁄) don't function properly. I've provided the enti ...

The callback function for the XMLHttpRequest object is not triggered when making a cross-domain request using jQuery/Ajax

Looking for some help with this code snippet I have: $.ajax({ xhr: function() { var xhr = new window.XMLHttpRequest(); xhr.addEventListener("progress", function(evt) { if (evt.lengthComputable) { var percentCo ...

What is the most effective approach for handling JSON data from URLs in a professional manner?

Hey there, I'm facing a dilemma on how to efficiently handle data retrieved from various URLs on my website. My website allows me to fetch JSON data from multiple URLs. For instance, there's a page full of posts related to a specific group with ...

Connect various models together, or create synchronized computed properties

At times, the model abstraction may fall short, leading to the necessity of synchronizing two different models. For instance, I have two lists linked by an angular sortable, which requires a model structure like this: left = [{name:"one"}, {name:"two"}]; ...

What is the best way to customize the size of a file upload Buefy component to have both a specific

I am looking to set up a file drop area with the Buefy component, but I want the size of the drop area to be 100% of both the width and height. The basic page is provided below, however, I am unsure about where to add the necessary width and height styles. ...

Looking to personalize your jVectorMap region popups? Here's how!

Currently, I am working with the jVectorMap library. While hovering over each country, the default label displays the country name. However, I would like to customize the map so that it shows regions based on database values. How can I achieve this custo ...