Skip to main content

Search and Top Navigation

#5765 closed bug (worksforme)

Opened June 23, 2010 10:52PM UTC

Closed October 11, 2012 05:38PM UTC

Last modified October 11, 2012 09:15PM UTC

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:
Description

line 664 of jquery.ui.datepicker.js

inst.dpDiv.zIndex($(input).zIndex()+1);

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

I only tested the minified version.

Attachments (0)
Change History (7)

Changed July 13, 2010 02:17AM UTC by dnlstffrd comment:1

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.

Changed July 19, 2010 07:13PM UTC by pierinz comment:2

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.

Changed July 26, 2010 08:20PM UTC by waltonl comment:3

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.

inst.dpDiv.zIndex($(input).zIndex()+1);

So I agree with making this change!

Changed June 13, 2011 04:56PM UTC by steelaz comment:4

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.

Changed February 21, 2012 08:16AM UTC by Mamen comment:5

I have the same problem.

jsFiddle test:

http://jsfiddle.net/mrmamen/gDNys/

z-index of input element: 2

expected z-index of datepicker: 3

actual z-index of datepicker: 1

Changed October 11, 2012 05:38PM UTC by scottgonzalez comment:6

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.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:7

milestone: TBD

Milestone TBD deleted