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

Increase picker z-index value (>v0.10.x) #180

Closed
plicas opened this issue May 17, 2017 · 8 comments
Closed

Increase picker z-index value (>v0.10.x) #180

plicas opened this issue May 17, 2017 · 8 comments

Comments

@plicas
Copy link

plicas commented May 17, 2017

Hi!
I'm using this picker inside one modal, and since the last update the picker is shown behind the modal.. looks like a Z-Index problem.

I'm using the cdn link, so i think that the problem is the last updates because on my side nothing changed.

UPDATE:
I change the cdn link to the version 0.9.11 and the picker is now working fine.

@kalle17
Copy link

kalle17 commented May 17, 2017

It seems that z-index:1000 for class .moment-picker is not enough when picker appends to body and picker is opened in bootstrap 3.x modal. For me it shows above modal div when .moment-picker CSS class has z-index:1050. I would suggest z-index:1500 to be on the safe side.

@indrimuska indrimuska changed the title Can't see picker inside modal since new update Set dynamic z-index based on the elements on the page May 17, 2017
@indrimuska
Copy link
Owner

indrimuska commented May 17, 2017

Thanks guys, this is well known for this release.
As @kalle17 already said, you should override the default z-index for your need. Anyway the final solution is to calculate the maximum z-index till the element that references the picker and then set that z-index value + offset.


Edit: it should be possibile to compute the z-index of a given element with this:

const style  = document.defaultView.getComputedStyle(element, null);
const zIndex = style.getPropertyValue("z-index"); // can return "auto"
//          or style['z-index'];
//          or style.zIndex;

Anyway, it does not take care of parents z-index value, so we should iterate till the root.

@indrimuska indrimuska changed the title Set dynamic z-index based on the elements on the page Set dynamic z-index based on the elements on the page (>0.10.x) May 17, 2017
@indrimuska
Copy link
Owner

indrimuska commented May 17, 2017

I've just analyzed the code of Bootstrap's tooltip and there's no calculation of z-index for parent elements, just a style rule for the tooltip hardcoded to 1070.

I thinks this choose lets the flexibility to easily override that value and also speed up performances because no computation are needed. So, I'm going to follow this way too, and I'll set the z-index value to 1060 (less than tooltip, more than modal). This is the same level value for the popover.

Those z-index values of Bootstrap seem re-used for v4 (alpha).

image

@indrimuska indrimuska changed the title Set dynamic z-index based on the elements on the page (>0.10.x) Increase picker z-index value (>v0.10.x) May 17, 2017
@EssenKh
Copy link

EssenKh commented May 29, 2017

@indrimuska
Can't fix this issue using z-index,
here is my source code:

                        <div class="form-group">
                                <p class="icon-group input-group ">
                                    <input readonly ng-model="startTime" class="form-control">
                                    <span class="input-group-btn ">
                                        <button moment-picker="startTime"
                                                          format="HH:mm"
                                                          type="button" class="btn btn-default">
                                            <i aria-hidden="true" class="glyphicon glyphicon-calendar"></i>
                                        </button>
                                    </span>
                                    <span class="show-date-picker"></span>
                                </p>
                            </div>

@galmok
Copy link

galmok commented Sep 13, 2017

I set this in my application css file:

.moment-picker {
z-index: 1060 !important;
}

Now moment-picker is visible, even in modals (but also on top of modals even if not wanted to).

@indrimuska
Copy link
Owner

A new version has just been released and includes a fix for this issue.

@chloegugli
Copy link

This issue doesn't seem fixed in the latest release (0.10.2)

@Alorenzog
Copy link

I'm using the angular Moment Picker - v0.10.2 version, I have the same issue
in ng-dialog windows.

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

No branches or pull requests

7 participants