jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

open() can create multiple overlay divs that break user interaction #390

Closed Thernys closed 7 years ago

Thernys commented 8 years ago

In open(), you have the following:

// ...
if (o.bootstrapDropdown === true && o.bootstrapModal === false) {
    // ...
    w.d.backdrop = $("<div></div>").css(...).appendTo("body")
    // ...
}
// ...

At least in my current use case this can result in multiple such overlay divs being appended. Every time the input group is clicked, another overlay gets added, even if the picker is already open. When the picker is closed, only one such overlay gets removed. If extras remain, they will obstruct other page elements and block click events, etc.

My DateBox package was generated 2016-05-02T12:40:49.916Z / version 4.0.0.

I am initializing DateBox the following way

this.$el.find('.sdp-date-input').datebox({
    mode: "datebox",
    useLang: i18n.lng(),
    useFocus: true,
    bootstrapDropdownRight: false
}).datebox('setTheDate', this.value.toDate());
jtsage commented 7 years ago

Well, that shouldn't be possible to happen - but clearly it is, so I went ahead and gave that backdrop div a class and made sure to nuke them all on close. If you can send me the HTML that causes this, that'd be awesome to help track it down.

Anyway, fix committed below.