When a mat-select is triggered, it opens behind a Bootstrap modal

Having an issue in my Angular project where a form with mat-selects is displayed in a bootstrap modal, causing the mat-select drop-down menu to appear behind the modal. Any ideas on how to fix this problem?

Form

<form [formGroup]="adhesionForm" (ngSubmit)="onSubmit()">

  <div class="row">
    <div class="col">
      <mat-form-field appearance="outline">
        <mat-label>Study Year</mat-label>
        <mat-select formControlName="studyYear">
          <mat-option value="1STPI">1STPI</mat-option>
          <mat-option value="2STPI">2STPI</mat-option>
          <mat-option value="3rd">3rd</mat-option>
          <mat-option value="4th">4th</mat-option>
          <mat-option value="5th">5th</mat-option>
          <mat-option value="nonINSA">Not at INSA</mat-option>
        </mat-select>
        <mat-error *ngIf="adhesionForm.invalid">{{getRequiredErrorMessage()}}</mat-error>
      </mat-form-field>
    </div>

  <div class="my-3 text-center">
    <button class="btn btn-primary" type="submit">Submit</button>
  </div>

</form>

Modal

<!-- Modal -->
            <div class="modal fade" #modal [id]="'unvalidModal' + i" tabindex="-1" aria-hidden="true">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <h1 class="modal-title fs-5">{{amicaliste.name}} {{amicaliste.lastName}}</h1>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                  </div>
                  <div class="modal-body">
                    <app-adhesion-form *ngIf="amicaliste " [amicaliste]="amicaliste"></app-adhesion-form>
                  </div>
                  <div class="modal-footer">
                    <a (click)="deleteAmicaliste(amicaliste)" class="details" data-bs-dismiss="modal">Delete Request</a>
                  </div>
                </div>
              </div>
            </div>

Any suggestions on how to address this issue would be greatly appreciated! Thank you!

Answer №1

One common issue arises when the z-index property of the modal surpasses that of the mat-select dropdown. You could experiment with adjusting the z-index value for the mat-select to a higher numerical value. If this doesn't yield results, consider utilizing the ::ng-deep selector.

::ng-deep mat-select .your-class {
 z-index: 999; // ensure it's above modal
}

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

The implementation of a JavaScript menu seems to be malfunctioning as the copies of the JavaScript thumb gallery are not functioning

Having a little issue with my website. When you click on "photography," the gallery displays correctly, but when you click on "photoshop," something goes wrong. I've copied the same code into the photoshop section and used javascript fadeIn & fa ...

watchPosition() will only trigger the callback function one time

I have been working on implementing a watchPosition function for the geofencing feature in MapDotNet's Touchgeo. The function works perfectly on initial load, but when I try refreshing the page, I only receive one line of debug messages indicating a s ...

Incorporating a YouTube or Vimeo video while maintaining the proper aspect ratio

On my video page, I embed Vimeo videos dynamically with only the video ID. This causes issues with the aspect ratio as black bars appear on the sides due to the lack of width and height settings. The dynamic video ID is implemented like this: <iframe ...

JavaScript generates a series of checkboxes dynamically, all lined up in a single row

I am currently working on a script where I iterate over objects and aim to display the text of each object on a new line in the list format, along with a checkbox next to it. Despite successfully printing everything with a checkbox, the issue I am facing i ...

IE compatibility problem with the alignment of input group buttons and textboxes in Bootstrap v4

Encountering an issue with input group in IE while using bootstrap v4, working fine in Chrome. Specifically using IE 11 Here is my plunkr: input group bootstrap v4 Chrome display: https://i.sstatic.net/yXtEW.png IE display: https://i.sstatic.net/WiRz ...

Modify content or display picture within accordion panel based on its identifier

In my view, I have a model representing a list of items. Each item has a unique ID, which is included in the H2 header tag. The details of each item are displayed in a div below the header. Initially, there is an image within the header that is set to disp ...

What is the best way to transfer a variable from the Cold Fusion back-end page to the HTML front-end section within a CFM file using jQuery Ajax?

My cfm file contains the necessary logic to extract a PDF and convert it into an image file. Now I am looking to pass the file path of this converted image to the front-end CFM so that it can be set as the source for the image tag below. <img id="image ...

Can you add custom styling to HTML within a Polymer paper-item component?

I am attempting to include rich content inside the elements of a paper-menu. However, it seems that this is not working as intended (refer to the screenshot below). What steps should be taken to incorporate styled HTML into the paper-item? Below is the p ...

How can we display the numbers between two given numbers in Ionic 2 while incrementing or decrementing the value?

I am developing a geolocation-based speed tracking feature that displays the speed on the screen. However, I have encountered a problem where there is a significant gap between the previous and current speed values, and I would like to implement a transiti ...

Angular 2: Enhancing Tables

I am looking to create a custom table using Angular 2. Here is the desired layout of the table: https://i.sstatic.net/6Mrtf.png I have a Component that provides me with data export class ResultsComponent implements OnInit { public items: any; ngO ...

On click, the current image should be replaced with the thumbnail image

I have been working on a project and came across a codepen link https://codepen.io/robgolbeck/pen/bVGmop that is similar to what I need. However, I am trying to achieve a specific functionality where clicking on a thumbs image replaces the large image with ...

The feature of option display is not supported on Safari browser

I am facing an issue with the functionality of two dropdown menus. The options in the second dropdown are supposed to be shown based on the selection made in the first dropdown. While this feature works perfectly in Chrome, it seems to be malfunctioning i ...

A bespoke Typescript implementation of nested lists containing numbers

Currently, I am trying to figure out how to declare and populate a TypeScript list of lists. The structure of the list should be as follows: List<CustomList<>, number> Typically, I would create a standard list like this: someList: { text: a ...

Vue and Vuetify tutorial: Implementing validation for individual chip items within a select input instead of the entire input field

Is there a way to implement validation (using vee-validate) on each individual chips item? Below is the current code snippet: <v-select class="elevation-0 mt-border-bottom" v-model="PhoneNumber" label="Add phone number" chips tags solo p ...

Ways to transform a CSS image to scale proportionally

Is there a way to zoom in on an image using the background-url property without affecting other elements? Here's what I have so far: .fakeImg:hover img{ transform: scale(1.1); } However, I need the image to grow only inside the specified div. C ...

Sign up for the subscription of a child Observable's Subscribe using RxJS

I have a method called emitEvenFrom that takes one argument and emits an event. When the argument is false, no event is emitted even though I am directly returning an observable of type of. import { Observable, Observer, of } from 'rxjs' funct ...

Modal consistently obtaining the initial identifier

One issue I am encountering involves a basic feedback section. Upon clicking the Reply button, a modal should open with pre-populated text and the FeedbackParentId set to the specific feedback being replied to. However, it consistently defaults to the firs ...

Deactivating Node.js files in vsCode for client-side JavaScript files

I'm facing a major challenge when it comes to coding with JavaScript. I have a JavaScript file that is using Node.js, which means I am unable to manipulate the DOM elements. Take this code snippet for example: var form = document.getElementsByClassNa ...

Managing TypeScript objects

Just starting out with TypeScript and feeling a bit lost. The data I receive from my BackEnd looks like this: { "A": [ { "fieldA": 0, "fieldB": "A", "fieldC": ...

Execute CSS within jQuery code only when the body class is present

I am attempting to use CSS (display: none;) within a script to hide elements from my menu only if a specific language is active. When the body class changes from one language to another, I want the script to check if the body class of a certain language ...