Side navigation in Angular is not causing the main content to shrink

In my layout, I have a container that includes two sidenavs and multiple tables in between them. When I toggle the left sidenav, instead of the expected behavior where the content shrinks to accommodate the sidenav, the tables get pushed to the right as if using mode="push" even though mode="side" is specified for this sidenav. This leads to inconsistent behavior that I need to address.

Learn more about changing the sidenav's behavior here

Upon further investigation, I noticed that when toggling the sidenav open, the tables gain a margin-left of 350px but their width (1870px) remains unchanged. This does not align with the expected behavior for mode="side":

https://i.sstatic.net/vJZst.png

Any ideas on how to solve this issue?

Here's the HTML code snippet for reference:

<mat-sidenav-container id="grid-container" class="grid-container">
 <mat-sidenav class="sidenavSearch" id="sidenavSearch" #sidenavSearch [opened]="false" mode="side" position="start">
  <app-patient-search [requestEnabled]="requestEnabled" (requestClick)="request()"></app-patient-search>
  <!-- removed for now  <app-history></app-history> -->
 </mat-sidenav>
 <mat-sidenav-content id="result" class="result">
  <div class="toggleSearch">
   <button class="toggleSearch" id="toggleSearch" mat-button (click)="sidenavSearch.toggle()"><mat-icon>search</mat-icon></button>
  </div>
  <div>
   <div class="title mat-headline padding" i18n="@@search:request:result">
    Result

   <!-- some tables -->
   </div>
  </div>
<div>
  <button class="toggleOptions" id="toggleOptions" mat-button (click)="sidenavOptions.toggle()"><mat-icon>settings</mat-icon></button>
</div>
 </mat-sidenav-content>
 <mat-sidenav class="sidenavOptions" id="sidenavOptions" #sidenavOptions [opened]="true" mode="over" position="end">
  <app-options></app-options>
 </mat-sidenav>
</mat-sidenav-container>

And here is the corresponding CSS code snippet:

.grid-container {
  display: grid;
  grid-template-columns: [searchToggle]25px [result]auto [optionsToggle]25px [end];
  width: 100%;
}

.toggleSearch {
  grid-column-start: searchToggle;
  grid-column-end: result;
  justify-self: end;
}

.teest {
  width: 25px;
}

.result {
  grid-column-start: result;
  grid-column-end: optionsToggle;
  width: 100%;
}

.toggleOptions {
  grid-column-start: optionsToggle;
  grid-column-end: end;
  justify-self: center;
  position: absolute;
}

.table-container:not(:last-child) {
  margin-bottom: 20px;
}

.title {
  align-items: center;
  background-color: #315A9A;
  color: white;
}

.table-title {
  background-color: #8d8d8d;
  color: white;
}

.padding {
  padding-left: 20px;
  padding-right: 20px;
}

#sidenavOptions {
  border-left: 1px solid black;
  box-shadow: 1px 0 2px grey;
  width: 250px;
}

#sidenavSearch {
  border-right: 1px solid black;
  box-shadow: 1px 0 2px grey;
  width: 350px;
}

Answer №1

To address the issue in your table, incorporate the bootstrap class 'table-responsive'.

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>

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

Generating a new object using an existing one in Typescript

I received a service response containing the following object: let contentArray = { "errorMessages":[ ], "output":[ { "id":1, "excecuteDate":"2022-02-04T13:34:20" ...

The dynamic combination of jCarousel, jQuery Accordion, and fade in effects

Take a look at this link www.aboud-creative.com/demos/mckinley3. You'll find a jQuery Accordion with jCarousel inside the "Developments" section. I have implemented a standard fadeIn function for the logo, accordion, and a stag on the bottom right to ...

jQuery Autocomplete without dropdown menu suggestion available

I'm working on a form for my webpage and I want to enhance user experience by adding autocomplete functionality. The goal is to suggest existing names as users type in the 'name' input text box. Although I can see in my console that it&apos ...

Angular2 Dependency Injection with NPM-MQTT

I'm facing some challenges integrating the MQTT package into my Angular2 TypeScript project (created with angular-cli). When using var mqtt = require('mqtt');, I encounter the error Cannot find name 'require'. Therefore, I attemp ...

Navigating in Angular using a "complete URL" (URL with parameters) can be achieved with the following steps:

My search page is equipped with numerous filter options, all of which are included as parameters in the URL for easy sharing. When moving from the search results to a detailed view of an item, I pass the complete search result URL as a parameter (detail/1? ...

Is it possible to maintain a div's height in proportion to its width using CSS?

Is it possible to set a CSS variable so that my div's height is always half of its width, and the width scales with the screen size (in percentage)? <div class="ss"></div> CSS: .ss { width: 30%; height: 50% of the width; } This ...

Error message: Angular material StaticInjectorError - MatDialog provider not found

After trying to launch my Angular 5 page in the browser, I encountered an error message in the console. ERROR Error: StaticInjectorError(AppModule)[AppComponent -> MatDialog]: StaticInjectorError(Platform: core)[AppComponent -> MatDialog]: ...

I seem to be having some issues with the functionality of .not() and it's

I am working on creating a menu that remains open for a set amount of time and then fades out if neither the parent nor the menu is hovered over. The goal is to have all other menus close when hovering over a new parent in the menu, but the current code k ...

Adding style using CSS to a dynamically generated table row in Vue.js

Currently, I am working with a table that dynamically generates rows using v-for: <table> <tr><th class='name'>Name</th><th>Surname</th></tr> <tr v-for='data in datas'><td class=&a ...

Tips on how to stop label text from wrapping onto a new line and only show one line

Working with asp.net mvc, I am encountering an issue where the label text is displaying on two lines instead of one. The expected behavior is for it to appear on a single line. I need the label text to display without wrapping to a new line. For example, ...

Differences in performance between Angular and JQuery_execution times

I am facing an issue on my dynamically populated Angular page. Angular sends a request to the backend using $http.get to retrieve data which then populates attributes of a controller. For example, when I call $http.get('/_car_data'), the JSON re ...

Converting Typescript objects containing arrays into a single array

Looking for some assistance with this problem :) I am trying to convert the object into an array with the following expected result: result = [ { id: 'test-1', message: 'test#1.1' }, { id: 'test-1', mess ...

Choosing the Right Language for AngularJS 2: TypeScript, JavaScript, or Dart?

AngularJS 2 is on the horizon, and the documentation recommends three languages: Typescript, Javascript, and Dart. As someone who primarily works with Javascript EcmaScript 5, I'm curious about the strengths and weaknesses of these three options. Cu ...

At runtime, the array inexplicably becomes null

Having recently ventured into the world of Ionic framework development, I have encountered a puzzling issue. At runtime, an array inexplicably gets nulled and I am struggling to pinpoint the root cause. export interface Days { name:string; } @Compon ...

Unable to retrieve nested objects from HTTP Response

After receiving data from a HTTP Response, I am trying to access and display it in my template. However, despite storing the data into a component variable, I am encountering issues when trying to access specific properties of the object. { "files": [ ], ...

Organizing DIVs upon website initialization

My website features a layout with three columns: <div id="column1"></div> <div id="column2"></div> <div id="column3"></div> I currently have 3 divs on the webpage: <div id="1">aaa</div> <div id="2">b ...

Disabling buttons in a Fiori UI5 application using HTML: A step-by-step guide

I don't have much experience with scripting languages. I am attempting to hide buttons within a SAP Fiori app by using the "Inspect element" tool in the Mozilla browser. When I delete the HTML code, the button disappears, but I would like to accomplis ...

Ways to conceal the scroll bar upon the initial loading of a webpage

Recently, I created a single-page website consisting of 4 sections. The client has specific requirements that need to be fulfilled: The scrollbar should not be visible when the page loads. Once the user starts scrolling past the second section, the scrol ...

The text displayed on the image is experiencing fluctuations

I am experiencing an issue on my website where the post text fluctuates rapidly when the mouse hovers over the image. I have a site where I display the post text on mouseover of the image. Can someone please help me solve this problem? You can test it by ...

Increase the value only when there is existing code present

I currently have a MySQL table with two columns. The first column stores IP addresses, while the second column holds integers that need to be incremented. Whenever a new IP address visits the website, the integer associated with that IP should increase by ...