Safari rendering issue causing mat-sidenav-container CSS to malfunction

I am encountering an issue with my mat-sidenav-container. While my code functions correctly on IE, Chrome, and Firefox, it appears broken only on Safari. The app-header should be fixed at the top, but it does not display as expected. I believe this error is related to the position:absolute property, yet I am unable to resolve it.

app.component;

<mat-sidenav-container [ngClass]="{'container':(!currentUrl && userAuth)}">
  <mat-sidenav [ngClass]="{'sidenavUser':(isExpanded && !currentUrl && userAuth),
                            'sidenavExpanded':(!currentUrl && userAuth && !isExpanded && !mobileQuery.matches)}"
   #sidenav role="navigation"
   [mode]="mobileQuery.matches ? 'over' : 'side'" 
   [(opened)]="!mobileQuery.matches && userAuth "
   fullscreen>

    <app-sidenav [mobileQuery]="mobileQuery.matches"  [userAuth]="userAuth$" (closeSidenav)="sidenavClose($event)"></app-sidenav>
  </mat-sidenav>

  <mat-sidenav-content>
    <app-header [ngClass]="{'header':(!currentUrl && userAuth)}"  [userAuth]="userAuth$"
      (sidenavToggle)="sidenav.toggle()"></app-header>

    <main>
      <router-outlet></router-outlet>
    </main>
  </mat-sidenav-content>
</mat-sidenav-container>

app.component.css

mat-sidenav{
  width: 250px;
  z-index: 1000;
}

  .sidenavUser {
    width: 250px;
    position: fixed;
    top:80px;
    bottom: 0px;
    z-index: 1000;
  }
  .sidenavExpanded{
    width: auto;
    position: fixed;
    top:80px;
    bottom: 0px;
    z-index: 1000;
    }

  mat-sidenav-content{

      height: 100%;
  }
  mat-sidenav-container{
  background-color: rgb(246, 246, 248);
  width: 100%;
  margin: 0;
  min-height: 1000px;
  }


  .container {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
  }
  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color:transparent;

  }

  .menuButton{
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;

  }

The issues persist with the positioning of .container and header being set to absolute which results in my toolbar being initially invisible.

toolbar.css

.toolbarTop{
  background-color:transparent;
  position: fixed;
  top: 0;
  height: 80px;
  z-index: 2;
  margin: 0;

} 
.toolbarOffsetY{
  background-color:rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  height: 80px;
  z-index: 1000;
  margin: 0;

}
.toolbarUser{
  background-color:rgba(0, 0, 0, 0.5);
  position: -webkit-sticky;
  position: sticky;
  /* For macOS/iOS Safari */
  top: 0;
  height: 80px;
  z-index: 1000;
  margin: 0;

}

Answer №1

I managed to resolve the issue by adjusting the position of the app-header. I discovered that when the app-header was placed inside the mat-sidenav-container, it caused a bug in Safari. Here is my updated code:

<div fxFlex>
**<app-header  [userAuth]="userAuth$"
      (sidenavToggle)="sidenav.toggle()"></app-header>**
<mat-sidenav-container autosize>
  <mat-sidenav [ngClass]="{'sidenavUser':(isExpanded && !currentUrl && userAuth),
                            'sidenavnotExpanded':(!currentUrl && userAuth && !isExpanded)}"
   #sidenav role="navigation"
   [mode]="mobileQuery.matches || currentUrl  ? 'over' : 'side'" 
   [(opened)]="!mobileQuery.matches && userAuth "
   fullscreen>

    <app-sidenav 
    [mobileQuery]="mobileQuery.matches"
    [currentUrl]="currentUrl" 
    [userAuth]="userAuth$"
    (closeSidenav)="sidenavClose($event)"></app-sidenav>
  </mat-sidenav>

  <mat-sidenav-content>
    <main>
      <router-outlet></router-outlet>
    </main>
  </mat-sidenav-content>
</mat-sidenav-container>
</div> 

In addition, I included the following CSS:

mat-sidenav-container{
  position: unset;
}

With these changes, the issue has been resolved successfully.

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

What methods can be used to apply the styles of one CSS selector to another?

When using Bootstrap CSS to ensure consistent button design on my site with the class "btn btn-primary," I encountered a dilemma. A plugin I'm utilizing has its own button class named "ethpress-metamask-login-button." Is there a way to make the "ethp ...

What is causing the top margin to be hidden from view?

Here is the following HTML code snippet provided: <div class="row"> <div class="column"> Some text </div> <div class="column blue"> Some other text </div> </div> Case One - The CSS code applied, without ...

Stop CSS tooltip from overflowing outside of the page or window

One issue I am facing is with a CSS-only tooltip that uses a span to display the tooltip when hovering over a link. The problem arises when the link is positioned near the top or side of a page, causing the tooltip to extend beyond the edge of the page. I ...

Implement the Angular 4 login form to validate and authenticate the application using IdentityServer 4

Can I implement a login form in my Angular 4 application that can post to the IdentityServer 4 project for authentication? Currently, I am utilizing oidc-client in the Angular app. The current process involves redirecting the user to the Identity Server ...

Create a stunning MUI App bar with a blurred effect below a fixed Navbar

Is there a method to apply a blur effect to the background of my material-ui AppBar component, creating a visually appealing overlay below the fixed navbar? I have experimented with using filter: blur(0) but it does not achieve the desired result. I am lo ...

MAJOR UPDATE: webpack versions before 5 previously contained polyfills for node.js specifically for 'timers-browserify'

Hey there, I'm encountering the error message below: ./node_modules/xml2js/lib/parser.js:38:17-47 - Error: Module not found: Error: Can't resolve 'timers' in '/Users/differentname/Desktop/workfiles/webdoc/ngx-admin-1/node_modules/x ...

How to access specific properties of an object within the subscribe function in Angular

I've successfully implemented an API that returns an array of table entity objects when queried. Here is the corresponding TableEntity interface in my Angular application: export interface TableEntity { partitionKey: string; rowKey: string; ...

Tips for dynamically altering the background color of the body in React

Is there a way to dynamically change the background color of the body on certain pages using Redux state? I'm encountering an issue where the color specified in the store is not recognized when passed in the componentDidMount() function. Here's ...

How can the height of a Material-UI Grid item be dynamically set to match its width?

I am trying to create grid items that are square, where the height matches the width: const App = ({ width, items }) => ( <Grid container> {items.map((v) => ( <Grid item md={width}> // I want this Grid item to be square ...

Angular Grade Calculator

I want to create an application where users can input a student's numerical grade into a form and receive the corresponding letter grade based on the following criteria: 100-91 A, 90-81 B, 80-71 C, 70-61 D, <=60 F. I am aware that Angular does not ...

Angular error: The object prototype can only be an Object or null, not undefined

My project was functional until I decided to install ExcelJs (npm install --save exceljs) and things took a turn for the worse. I started encountering errors such as Cannot read property ‘Minus’ of undefined and Cannot find module 'postcss-value- ...

Issues with CSS styling are affecting the display of a form

Hey there! I was working on creating an order form for my website, and everything was going smoothly until I hit a snag while styling the webpage. The problem is that the legends of the form are extending all the way to the right side of the page, and the ...

Issues arising from switching Angular deploy-url

I am looking to deploy my web application using spring-boot with an angular front-end on a Tomcat server. I have built the angular app using the Angular-CLI and the command below: ng build --deploy-url /mywebapp/ The application is functioning, but I am ...

Excessive padding observed on the right side of the screen when viewed on mobile devices

I am having an issue with my portfolio site where there is a white space on the right side in the mobile view, but only in Chrome. The desktop and Mozilla mobile views are fine. I have attached a screenshot highlighting the problem. Here is the link: Chrom ...

Adding a simulated bottom border to a rotated container

Currently, I am utilizing the CSS3 rotate value to create an arrowhead effect for modal boxes. However, I now require a full arrowhead design with a bottom border. As this involves rotating a div at a 45° angle, adding another border to either side will n ...

What is the best way to display table headers for each record on mobile devices? Is there a way to create a stacked view

I recently started working with bootstrap, specifically version 3. I am currently trying to find a way to create a layout that resembles a regular table when viewed on desktop but switches to a stacked format on mobile devices. This is the design I am aim ...

Creating effective href anchors within an iframe using the `srcdoc` attribute

While loading some HTML content in an iframe using the srcdoc attribute, I encountered an issue where following anchor tag links inside the iframe caused the entire page to load within the iframe instead of scrolling to the linked id. You can see a demons ...

Adding a class to a field tag in a Django form: A step-by-step guide

Is there a way to add a bootstrap class to the label of an input field in a form? I know how to add classes to the input field itself, but I haven't been able to find a guide on adding a class to the label within the form declaration. Can anyone provi ...

Aligning a label in the center of a horizontal layout's vertical axis

Struggling with centering a QLabel vertically in a QHBoxLayout. Here's the relevant part of my code: QFrame* topBar = new QFrame(); topBar->setStyleSheet("background-color: #2c3d50;border-bottom: 3px solid #2c92b6;"); topBar->setSizePolicy(QSiz ...

What is the best way to ensure the navigation bar stays at the top of the window once it has reached

I have a sample js fiddle provided here. The navigation bar is positioned right below the "Hello World" section, and the content follows beneath the nav bar. Is there a way to make the navigation bar stick to the top of the window once it reaches that poin ...