chrisdavies / tiny-date-picker

A small, modern, dependency-free date picker
https://chrisdavies.github.io/tiny-date-picker/
415 stars 88 forks source link

Input field in modal, date picker closes on button click #102

Open eimantasbucys opened 5 years ago

eimantasbucys commented 5 years ago

So I have my input field in modal and using dp-below, I changed z-index in css file to draw date picker on top of my modal but the problem is when I press any button on date picker (eg. next or previous month) it closes. In chrome dev tools I can see it fires this event:

    on(
      "blur",
      calEl,
      bufferFn(150, function() {
        if (!dp.hasFocus()) {
          dp.close(true);
        }
      })
    );
vigorouscoding commented 4 years ago

I just ran into the same problem and found a quick and dirty solution.

The modal has tabindex="-1" role="dialog" and the element directly underneath it has role="document". Removing all of those attributes solved the problem for me.