Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker popup attached to body is shown behind modal window #4278

Closed
HexagonSun opened this issue Mar 9, 2022 · 3 comments · Fixed by #4282
Closed

DatePicker popup attached to body is shown behind modal window #4278

HexagonSun opened this issue Mar 9, 2022 · 3 comments · Fixed by #4282

Comments

@HexagonSun
Copy link
Contributor

Bug description:

Configuring a NgbDatepicker with container="body" and placing it within a NgbActiveModal dialog causes the datepicker's popup to be shown underneath the modal's backdrop.

image

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-ukonh5?file=src/app/modal-basic.html

This Stackblitz is forked from the "
Modal with default options" example here, and the only change is adding container="body" to the input.

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 13.0.3

ng-bootstrap: 12.0.0

Bootstrap: 5 (whatever ng-bootstrap 12.0.0 depends on, locally I use bootstrap 5.1.3)

@HexagonSun
Copy link
Contributor Author

HexagonSun commented Mar 9, 2022

This seems to be a regression, as there was #3133 which is basically the same issue.

As far as I can see, the issue is caused by

  • The modal window and backdrop having z-index: 1055
  • But the datepicker's .ngb-dp-body's z-index is 1050 (Edit: it's currently 1050, not 1055 as I previously wrote).

It seems that the z-index for the modal was increased, but .ngb-dp-body not adapted.

Edit: found it: fc84cb1d.

HexagonSun pushed a commit to HexagonSun/ng-bootstrap that referenced this issue Mar 12, 2022
When using container="body", the datepicker's `z-index` must be equal
or above the modal window's one (as defined in `modal.scss`).

Fixes ng-bootstrap#4278
HexagonSun added a commit to HexagonSun/ng-bootstrap that referenced this issue Mar 12, 2022
When using container="body", the datepicker's `z-index` must be equal
or above the modal window's one (as defined in `modal.scss`).

Fixes ng-bootstrap#4278
@maxokorokov maxokorokov added this to the 12.0.2 milestone Mar 24, 2022
maxokorokov pushed a commit that referenced this issue Apr 4, 2022
When using container="body", the datepicker's `z-index` must be equal
or above the modal window's one (as defined in `modal.scss`).

Fixes #4278
@alvintan99
Copy link

Edit line 23 of modal-basic.html and the datepicker will be on top of the modal. @HexagonSun

<input
  id="dateOfBirth"
  class="form-control"
  placeholder="yyyy-mm-dd"
  name="dp"
  ngbDatepicker
  #dp="ngbDatepicker"
  container="modal-body"
/>

@lamson11
Copy link

image
muốn code giao diện giống vậy mình dùng loại date picker nào

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants