Opened 10 years ago

Closed 8 years ago

Last modified 8 years ago

#5765 closed bug (worksforme)

datepicker doesn't inherit z-index from input

Reported by: jackdied2 Owned by:
Priority: minor Milestone:
Component: ui.datepicker Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:


line 664 of jquery.ui.datepicker.js


$(input).zIndex() always returns 0, even when and $(input).css('z-index') return something else.

I only tested the minified version.

Change History (7)

comment:1 Changed 10 years ago by dnlstffrd

I can attest to this as well, the z-index of the datepicker is always being set to 1. Is there a workaround for this? I tried using the dialog version, but this is not sufficient since it only sets the z-index to 2, and I need it to be at least 5.

comment:2 Changed 10 years ago by pierinz

I'm affected by this problem, too. I think users must set z-index with css rules as needed, it's almost useless to set a higher z-index when most input have z-index: auto.

comment:3 Changed 10 years ago by waltonl

It does seem like this line defeats the purpose of being able to set your own in any of the previous ways .... like: via css class OR using beforeShow to compute and return a z-index.


So I agree with making this change!

comment:4 Changed 9 years ago by steelaz

Had the same issue, opened jquery.ui.core.js and found this line: if (position == 'absolute' || position == 'relative' || position == 'fixed'). My element position was "static" (by default), so I explicitly changed it to "relative" and $.zIndex() started working properly.

comment:5 Changed 8 years ago by Mamen

I have the same problem. jsFiddle test:

z-index of input element: 2 expected z-index of datepicker: 3 actual z-index of datepicker: 1

comment:6 Changed 8 years ago by Scott González

Resolution: worksforme
Status: newclosed

As steelaz mentions, z-index isn't applied unless the element is positioned. Set position: relative to get the z-index to apply.

comment:7 Changed 8 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.