The MUI5 drawer overlapping a modal dialog

Is it possible to use MUI5 to open a side drawer on top of a modal dialog that triggers it? Currently, the dialog triggers the side drawer but it opens behind this.

It appears as though a modal dialog (drawer) is attempting to open over an already-opened modal dialog.

Check out this example on codesandbox.

https://codesandbox.io/p/sandbox/dialogwithdrawer-y793fx?file=%2Fsrc%2Findex.js

Answer №1

After some experimentation, I found that adjusting the z-index is key in getting the drawer to open over the modal dialog. By manually changing their z-index values, I was able to achieve this effect. It's important to also modify the MuiDialog-root className, as its default z-index is set to 1300. Lowering this value below the drawer's z-index should resolve the issue.

If desired, you can alternatively adjust the z-index of the Drawer component like so:

<Drawer
   anchor={anchor}
   open={state[anchor]}
   onClose={toggleDrawer(anchor, false)}
   style={{ zIndex: "1399" }}
   >
      {list(anchor)}
</Drawer>

This method should produce the same result. Here is a link to my version of your sandbox with these changes implemented: sandbox fork.

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

Mastering preventBack() Functionality - A Foolproof Method to Eliminate a Div on Back

This unique code prevents the page from going back when using the back button: <script type = "text/javascript" > function stopGoingBack(){window.history.forward();} setTimeout("stopGoingBack()", 0); window.onunload=function(){null}; ...

Change the behavior of an onclick event on the second click

I'm trying to make a button on my website that not only plays music when clicked but also changes the text inside the button to "Go to SoundCloud" and redirects to SoundCloud. Currently, I have been able to achieve both functions separately - redirect ...

Inserting HTML content into a DIV with the help of jQuery

Looking for a solution with my index.html file. I want to load other HTML files into a DIV by clicking on buttons. Here's an example of what I'm trying to achieve: I've searched through various examples online, but none seem to work for ...

utilize a modal button in Angular to showcase images

I am working on a project where I want to display images upon clicking a button. How can I set up the openModal() method to achieve this functionality? The images will be fetched from the assets directory and will change depending on the choice made (B1, ...

Unique version: "Dynamic appbar with a single application that displays a back button for easy navigation within

In my app.js file, the code structure is as follows: class App extends Component { render() { const {classes} = this.props; return ( <React.Fragment> <AppBar/> <BrowserRouter> <Route render={( ...

Execute a JavaScript code prior to sending a response directly from the ASP.NET code behind

On my .aspx page, I have the following code which prevents the page from responding without confirmation: <script type="text/javascript"> window.onbeforeunload = confirmExit; function confirmExit() { return 'Are you sure you wan ...

Navbar in bootstrap appears to be flashing when it is in its expanded

Example Link On smaller screens, the bootstrap navbar menu does not collapse by default when clicking on a menu item. To fix this issue, I added attributes data-toggle="collapse" and data-target="#navbar-collapse" to each menu item so that the menu will ...

Creating a JavaScript function using jQuery to calculate the total sum of textboxes with two specified classes

I'm currently attempting to calculate the total of a group of textboxes by utilizing jquery. Each textbox is styled with a class (class1) using bootstrap. To execute the jquery function, I've added an extra class (class2). Below is an example of ...

Guide to custom sorting and sub-sorting in AngularJS

If I have an array of objects like this: [ { name: 'test1', status: 'pending', date: 'Jan 17 2017 21:00:23' }, { name: 'test2', sta ...

What is the solution for correcting the error message "Prop `className` doesn't match. Server: 'MuiFormLabel-root-75....' "?

Currently using NextJS, I attempted to incorporate "@material-ui/core" into my project. Upon trying to utilize the TextField, I encountered the following error: index.js:2178 Warning: Prop className did not match. Server: "MuiFormLabel-root-75 MuiInpu ...

Dealing with AngularJS memory leaks caused by jQuery

How can I showcase a custom HTML on an AngularJS page using the given service? app.service('automaticFunctions', function ($timeout) { this.init = function initAutomaticFunctions(scope, $elem, attrs) { switch (scope.content.type) { ...

Transform the character encoding from a non-standard format to UTF-8

Imagine a scenario where there is a page with <meta charset="EUC-KR">, let's call it address-search.foo.com, that allows users to search for an address and sends the data to a specified URL by submitting an HTML form using the POST met ...

What is the purpose of storing the Vue instance in a variable or constant?

As a newcomer to Vue, I've noticed that in many tutorials and documentation sources, the new Vue instance is often stored in a variable like app. I'm curious, what is the benefit of saving the Vue instance in a constant or variable? const app = ...

Data retrieval seems to be encountering issues in Firefox and IE9, whereas Chrome and Safari are functioning without any problems

I am using the following method function callCommentservice() { try { // Comment Service Url var getCommentServiceUrl = self.commentsServiceUrl + self.getRating + "tenantId=" + self.tenantId + "&ratedObjectTypeId=" + sel ...

Looking to adjust the title font size when exporting DataTable to Excel?

Would like to customize the title of an excel file exported from Datatable. I attempted to implement a solution found on a stackoverflow post, but it ended up applying the customization to the entire sheet. $("#datatable").DataTable({ ...

Using Sequelize to update all values in a JSON file through an Express router.put operation

I've been working on a feature in my Express router that updates data in a MySQL schema for 'members' of clubs. The members table has various columns like member_id, forename, surname, address, etc. I've successfully created an Express ...

Tips for managing onClick code when a user selects "open link in new tab" within a React js environment

How can I ensure that my tracking code runs when a user clicks a button in my React project, even if they open it in a new tab? Is there a solution for this in React JS? Here's a simple example: var Hello = React.createClass({ render: function( ...

Verifying a form submission using a personalized model popup

I have several delete forms in my application that I want to confirm using javascript/jQuery before proceeding. An easy way to do this is: $('form.confirm-form').submit(function(){ return confirm('Are you sure?'); }); This method ...

Having trouble retrieving information from a nested JSON array within a JSON object using JavaScript

I am facing a challenge with extracting specific information from a JSON object that contains an array nested inside. Even though I have experience working with JSON arrays, this particular object is proving to be tricky. For example, when attempting to r ...

Firefox triggers drag events while passing over a div scrollbar

I am looking to create a file drag and drop feature using a styled div: When dragging files over the div, I want the border color to change When dragging files out of the div, I want the border color to revert back to the original In Firefox 35 (Ubuntu) ...