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

picker flickering when using useFocus true and useNewStyle false #296

Closed lvostinar closed 10 years ago

lvostinar commented 11 years ago

When we use these two options (using calbox mode) and click on field to open picker the picker opens twice causing a flicker effect. This is caused by two different events that open picker:

w.d.wrap.parent().on(o.clickEvent, function() { if ( !w.disabled && o.useFocus === true && o.useNewStyle === false ) { w.d.input.trigger('datebox', {'method': 'open'}); w.d.wrap.addClass('ui-focus'); w.d.input.removeClass('ui-focus'); setTimeout(function(){ w.d.wrap.removeClass('ui-focus'); w.d.wrap.parent().addClass('ui-focus'); }, 500); } });

and

.focus(function(){ if ( w.disabled === false && o.useFocus === true ) { w.d.input.trigger('datebox', {'method': 'open'}); w.d.wrap.addClass('ui-focus'); w.d.input.removeClass('ui-focus'); if ( o.useNewStyle === false ) { w.d.input.parent().removeClass('ui-focus'); w.d.wrap.parent().addClass('ui-focus'); } } if ( o.useNewStyle === false ) { w.d.input.removeClass('ui-focus'); } })

jtsage commented 10 years ago

Indeed. Added a useFocus trap to newStyle:false to just focus the input on button click rather than actually opening.