Modal obstructing BsDatePicker

<!-- The Server Modal -->
<div class="modal" id="serverModal">
    <div
        class="modal-dialog"
        style="max-width: 80%;overflow-y: initial !important;"
    >
        <div class="modal-content">
            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title">
                    User # {{ globals.currentUser }}
                </h4>
            </div>

            <!-- Modal body -->
            <div
                class="modal-body"
                style="max-height: calc(100vh - 200px);
    overflow-y: auto;"
            >
                <table class="table table-striped table-bordered">
                    <tbody>
                        <tr>
                            <td>
                                <div class="row">
                                    <div class="col-6" style="width:150px;">
                                        ObsoleteServerActionDate
                                    </div>
                                    <div class="form-group col-6">
                                        <input
                                            type="text"
                                            placeholder="DOJ"
                                            class="form-control"
                                            bsDatepicker
                                            [bsConfig]="{
                                                dateInputFormat: 'MM/DD/YYYY',
                                                containerClass: 'theme-dark-blue' 
                                            }"
                                        />
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <!-- Modal footer -->
            <div class="modal-footer">
                <button
                    type="button"
                    class="btn btn-primary"
                    data-dismiss="modal"
                    (click)="SaveServer()"
                >
                    Save
                </button>
                <button
                    type="button"
                    class="btn btn-danger"
                    data-dismiss="modal"
                    (click)="CancelServer()"
                >
                    Cancel
                </button>
            </div>
        </div>
    </div>
</div>


When I trigger the modal, the date-picker element within the table hides behind the modal and I have tried adjusting its z-index with no success. Why is this happening?

Answer №1

For optimal results, it is recommended to assign the z-index property to the container element. Consider the following approach:

.theme-dark-blue {
   z-index: 3000 !important;
}

If there is a configuration property available, you can take advantage of it:

[bsConfig]="{ dateInputFormat: 'MM/DD/YYYY', containerClass: 'theme-dark-blue show-at-top' }"

.show-at-top{
   z-index: 3000 !important;
}

Answer №2

To ensure proper positioning in the input element's parent chain, apply the CSS rule position:relative to the initial td element.

The input element below in your code must be contained within a parent element that also has position:relative.

<input type="text"
       placeholder="DOJ"
       class="form-control"
       bsDatepicker 
       [bsConfig]="{ dateInputFormat: 'MM/DD/YYYY', containerClass: 'theme-dark-blue' }"
>

I have previously resolved this issue by applying the CSS rule to the first td element in the parent chain.

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 nodemailer module in Node.js encountered an issue while trying to send an email, resulting

Looking to confirm registration, I want to send an email from my server (kimsufi). To accomplish this, I am utilizing nodemailer which can be found at https://github.com/andris9/Nodemailer Encountering the following error: Error occurred Sendmail exited ...

Are there any alternatives to PHP for implementing an auto-complete search feature?

I have decided to focus on using HTML, MySQL, JavaScript, and jQuery for my project. Though I understand that learning PHP would be beneficial in the long run, I don't have enough time to master it all within a week. As for the server-side, I will be ...

Retaining specific items in a collapsed Bootstrap Navbar

I am looking to keep certain items in my navigation bar visible, but also have a collapse toggle when the window becomes too small on the right side. Example: LOGO item item item Sign In Sign Up When collapsed: LOGO ...

Leveraging formvalidation.io within a Bootstrap 5 modal to enhance user input validation

I have successfully implemented the functionality to load a remote page into a Bootstrap 5 Modal using AJAX. Below is the code snippet to open the modal: <button type="button" data-id="5" class="btn btn-status">Open< ...

Customize your webpage's style to reflect your unique identity with user

Is there a way to allow users to customize the style of a webpage? I know I need multiple CSS files, but how can I implement the code that enables this customization based on user preferences? ...

Transform the array of strings

I'm currently working with an array that looks like this: ["[Date.UTC(2016,09,30),250500.00]","[Date.UTC(2016,09,29),255100.83]", "[Date.UTC(2016,09,28),255600.82]"] What would be the best way to transform it into a structure like this? [[Date.UTC( ...

scrolling through a list using .slice choosing an excessive amount of items

Is it possible to create a dynamic pager that can be customized using parameters from the URL? I have noticed that when I hardcode the perTime variable, everything works fine. However, as soon as I try to use a parameter from the URL, the page starts behav ...

The 8 x 8 grid I am constructing is functional, however, the issue lies in the fact that the first line only begins with a single # symbol

I am attempting to create an 8 x 8 grid. It's coming together, but the issue is that the first line only starts with one # sign. function print(msg) { console.log(msg); return msg; } let result = ""; for(let i=1; i<=8; i++) { result += ...

The class "slick" in <col class="slick"> does not add any styling or effects

My interpretation of the col element is that it can be used to assign a class to all elements in a column of a table. However, I am experiencing difficulties with this approach. While I am able to apply the class to individual td elements, I am looking for ...

Implementing the adding functionality within an ejs file

I'm currently working on a project that involves fetching data from an API using a simple JavaScript file upon clicking a button. Initially, everything was functioning properly when both the HTML file and JS file were in the same folder, and I could a ...

Having trouble with Three JS shadows not displaying correctly?

I recently built an interactive 3D model on my website using ThreeJS, but I'm facing an issue with getting the shadows to work properly. As a beginner in ThreeJS, I might be missing out on some crucial steps. Below is the JavaScript code I've us ...

Saving an image and form data together in local storage can be accomplished by using JavaScript

Is there a way to save an image to local storage along with form data? I would like to store the form data in a database and keep the image in local storage. Any help would be greatly appreciated. Thank you! <form id="saveImageForm"><input type ...

The observable object fails to update the view in Knockout

I'm struggling with this error and need some assistance. I've been working on it for a while, but haven't made any progress. Any help would be greatly appreciated! Thanks! Error: VM4705 knockout-debug.js:3326 Uncaught ReferenceError: Unabl ...

Yaml scripting for BunJs CLI commands

Are there any CLI tools in bun.js that are capable of interpreting Yaml scripts? Similar to how npm processes package.json files in node.js, allowing script definition and execution from the command line interface, but with Yaml being a more readable form ...

How to detect a click event in any area of an Angular2

Hey there, I'm new to typescript and angular 2 and I've encountered an error in my code. Can someone lend me a hand in fixing this? import { Component, HostListener } from '@angular/core' export class TooltipComponent { public sh ...

By default, the sidebar is open on desktop devices while closed on mobile devices

I am struggling to figure out how to set my sidebar/navigation content, using Bootstrap, to be expanded by default on desktop and closed by default on mobile with the icon only showing on mobile devices. Despite multiple attempts, I cannot seem to make thi ...

Is there a way to detect duplicate usernames in a form without actually submitting the form, and then automatically focus on the username field if a duplicate is

I need help with a user registration form that I am creating. I want the form to automatically search for an existing username as soon as the user starts typing in the username field. If the username already exists, I want the field to receive focus. In my ...

What is the most efficient way to retrieve the current user's ID within Loopback?

Given the instability and deprecation of loopback.getCurrentContext(), what strategies can I use to accurately identify users when they interact with API endpoints? Is it feasible to include the token ID in the request payload for verification purposes? H ...

Tips for debugging Angular applications with Firebug

I've encountered an issue while developing an AngularJS app that fetches data from the Firebase cloud. The data is successfully displayed on the page, however, during debugging of my controller, I noticed that the variable appears to be empty. Why is ...

Angular does not select the variable_name within the $scope

Here is the HTML code I have written. <div class="container" ng-app="mintcart"> <div class="panel panel-default" ng-controller="categoriesctrl"> <input type="hidden" ng-model="session.sid" value="<?php echo session_id();?>"/&g ...