Troubleshooting Z-Index problem with Material UI Drawer component on iOS

I'm currently working on a project that involves the use of the Material UI Drawer component.

However, I've encountered a specific issue when using an iPad, which presents two main problems: - The overlay does not appear above the navigation bar and content body - The drawer does not appear above the overlay

Upon inspection, it seems like this issue is related to z-index, potentially caused by the presence of "transform: translateZ(0px);"

Below is the HTML code for the rendered overlay:

<div style="position: fixed; height: 100%; width: 100%; top: 0px; left: 
0px; opacity: 1; background-color: rgba(0, 0, 0, 0.541176); -webkit-
tap-highlight-color: rgba(0, 0, 0, 0); will-change: opacity; transform: 
translateZ(0px); transition: left 0ms cubic-bezier(0.23, 1, 0.32, 1) 
0ms, opacity 400ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; z-index: 1200; 
pointer-events: auto;"><!-- react-empty: 149 --></div>

And here is the main div rendered HTML for the drawer:

<div style="color: rgb(255, 255, 255); background-color: rgb(0, 0, 0); 
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; box-
sizing: border-box; font-family: Roboto, sans-serif; -webkit-tap-
highlight-color: rgba(0, 0, 0, 0); box-shadow: rgba(0, 0, 0, 0.156863) 
0px 3px 10px, rgba(0, 0, 0, 0.227451) 0px 3px 10px; border-top-left-
radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 
0px; border-bottom-left-radius: 0px; height: 736px; width: 200px; 
position: absolute; z-index: 1300; left: -207px; top: 0px; overflow: 
auto; -webkit-overflow-scrolling: touch; margin-left: 50%;">

From the information provided above, we can see that the overlay has a z-index value of 1200, the drawer is set at 1300, and the navigation element holds a z-index of 1030.

It's worth noting that the Drawer functions smoothly in Chrome and Safari on Mac.

Answer №1

When using position: fixed with a z-index of 1200, it can easily override a position: absolute element with a z-index of 1300 if the absolute positioned div is a child of a parent with a lower z-index than 1200

The comparison between these two z-indexes is not straightforward due to their different positioning properties. The fixed element is always relative to the window, while the absolute element could be inside of any positioned parent, creating separate stacking contexts.

To fully understand the stacking behavior in your case, more context from your code would be necessary.

Answer №2

Encountering a similar problem like the ones mentioned below.

Issue with z-index on Safari due to webkit-transform

Loss of z-index after using webkit transform translate3d in CSS

A common solution is to include a 3d transform on the parent element (the shared parent of overlay and drawer, in this scenario).

I've personally resolved a similar issue by including the following code snippet.

-webkit-transform: translate3d(0px, 0px, 0px)

In addition to this, there are various solutions offered on the provided links above.

Hoping this information proves helpful.

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

I am struggling to align elements properly with Bootstrap, and I am encountering issues with the border radius of a specific div

I'm having trouble aligning all the elements in the center of my login form created with HTML and Bootstrap. The header appears to be center-aligned, but it is not vertically aligned with the other elements. I've been using the Grid system and ne ...

Using NSUserDefaults in conjunction with asynchronous URL connections can lead to surprising outcomes

In my code for handling asynchronous UrlConnections, I encounter an issue when adding a NSString to a NSMutableArray in case of a failed request. The first time the addition works fine, but the second time it results in an error: 'NSInternalIncons ...

Can the Browser width/document width be maintained when shrinking the browser window size?

https://i.stack.imgur.com/a4gfA.pngLooking for a solution to maintain the browser/document width at 350px, preventing users from minimizing the window. The desired width is actually 400px, not 350px. Please refer to the image above. I require the window ...

Customize button appearance within mat-menu in Angular versions 2 and above

Is there a way to style my mat-menu to function similar to a modal dialog? I am having difficulty with the styling aspect and need advice on how to move the save and reset buttons to the right while creating space between them. I have attempted to apply st ...

Make sure to add a mark on a particular date using Material-UI with the help of React

I was searching for this information in the Material-UI documentation but couldn't find it. Can anyone confirm if it's possible to highlight certain dates, like events on Google Calendar, using Material-UI in React? [Here is my code snippet](ht ...

Angular Recursive Bootstrap Breadcrumb Guide

I am looking to implement the bootstrap breadcrumb component (https://getbootstrap.com/docs/4.0/components/breadcrumb/) in my project. My goal is to use the breadcrumb to show the entire path to the current directory within a component that resembles a di ...

Is there a way to keep the text animation going even when I'm not hovering over it with the cursor?

Is there a way to make text continue animating on the page even when the cursor is not placed on it? I understand the hover function, but how can I ensure the text keeps animating without interruption? $(document).ready(function () { $("#start&q ...

Mobile site experiencing owl.carousel responsiveness issues after refreshing the page

I am currently working on a website located at . On the homepage, right after the slider, there is a carousel of three info boxes. However, in mobile view (developer mode), after a hard refresh or viewing the link on an actual mobile device, it displays a ...

Is there a way to specifically import only variables and mixins from Sass stylesheets?

Using the Zurb Foundation 4 (S)CSS framework has presented a challenge with massively duplicated styles. Each file that I import 'foundation' into brings along all of Foundation's styles, resulting in redundant declarations for body, .row, . ...

The custom CSS styling is triggered only when the page is resized in Bootstrap

Currently, I am utilizing bootstrap alongside my custom CSS. The issue I am facing is that some of the styling from my custom CSS only takes effect after resizing my browser window to a smaller size. My custom CSS seems to be applied when the website adapt ...

Styling multiple Higher Order Components (HoCs) using Material UI withStyles

When developing my application, I encountered an issue with using Higher Order Components (HoCs) and withStyles for styling. If I apply multiple HoCs to one component, the classes prop of the first HoC gets passed to the next one in the compose chain, caus ...

Remove the triangle shape from the div and reveal the background

Is it possible to use CSS tricks to cut a triangle out of a div and show the background behind it? I didn't think this was achievable, but I know you pros can surprise me. Here's what I'm aiming for: Please don't suggest a 3-column sol ...

Looking to access Apple in-app purchases? Learn how to retrieve the products that are currently available

When it comes to prompting a user in my class to make an in-app purchase, they are given the option to click "buy" to initiate the purchase process. However, I am facing difficulty in locating the product object that needs to be purchased. The method I am ...

How do you determine the dimensions of a background image?

My div is a perfect square, measuring 200 pixels by 200 pixels. The background image I've chosen to use is larger at 500 pixels by 500 pixels. I'm searching for a method to ensure that the entire background image fits neatly within the confines ...

The Infinite Loop: Unveiling the En

I'm interested in creating a unique shape resembling the symbol of infinity using CSS, SVG, or Canvas. If you're unfamiliar with what an infinity symbol looks like, here's an example: https://i.stack.imgur.com/cLhBh.jpg So far, I've a ...

I attempted to initiate a transition using JavaScript, but unfortunately it failed to execute

Hey there! I'm just starting out with HTML, CSS, and JavaScript, and I've been trying to make a transition work using JavaScript. The element I'm working with is a "menu-icon" which is a span tag with a small image nested inside another div ...

Ways to eliminate border from Material-UI text field

How can I remove the border from an Input field in Material UI? I attempted using border="none", but it did not work. Here is a screenshot ...

What is the best way to create a button with a dynamic background animation in React?

Looking to design a button with an animated background, possibly in gif or video format. An example of what I have in mind is the DOWNLOAD button on this website's main page: Ideally, I am hoping for a solution using React. ...

The bottom portion of my page vanishes without a

My footer has the following CSS class: .footer{ border-top:solid 2px #BBB; background : url('../images/footer.png'); font-family : helvetica; font-style : italic; height:9em; clear: both; color: black; wid ...

Navigating the world of Swift development can be daunting, especially when it comes to Alamofire and Swifty

I am struggling to create an Array using SwiftyJSON.JSON. Parsing a struct is fine, but parsing an object-array is giving me trouble. Can anyone assist with this issue? Here is the JSON data: { "result": { "list": [ { "categoryId": 1, ...