Opened 3 years ago

Last modified 2 years ago

#14980 new bug

Datepicker: Misaligned when attached to a hidden input, inside of a fixed-positioned element, when scrolled down

Reported by: Mark Penner Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.11.4
Keywords: Cc:
Blocked by: Blocking:

Description

Here's an example: https://jsbin.com/zijipej/2

Here's the code: https://gist.github.com/anonymous/8cf1943bd68df44d80d5e855455c2a3d

And a screenshot: http://i.imgur.com/x40UB5o.png

Happens in both Chrome and Firefox, unsure about other browsers.

To recreate:

  1. Open the example
  2. Scroll down and click "Open Fancybox"
  3. Click the "..." button

I dug through the jQuery UI source code a bit. When the input element has a "fixed" ancestor, then it puts the ui-datepicker-div into "fixed" position mode too, but the offset calculation is incorrect.

Here's a monkey-patch I created: https://gist.github.com/mnpenner/4a52366150deaa44d377c872c7d1fda3

I haven't thoroughly tested it, but it fixes this particular case.

This is with the patch applied: https://jsbin.com/zijipej/3

Reproduced in both jQuery UI 1.11.4 and 1.10.5.

Change History (1)

comment:1 Changed 2 years ago by Scott González

Component: ui.coreui.datepicker
Note: See TracTickets for help on using tickets.