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

SlideBox Selection Does Not Always Center Focus #414

Closed ryhcu404 closed 7 years ago

ryhcu404 commented 7 years ago
  1. Pull up SlideBox (using "useInline":false).
  2. Click a new value to change the date and click "Set Date".
  3. Reopen the SlideBox using the icon. The selection will be made, but it will be out of view (not centered).

I've experienced this issue on the SlideBox demo itself on this page http://dev.jtsage.com/DateBox/, as well as in my test environment: JqueryMobile (v1.4.5) jquery-mobile-datebox (v4.2.3) Firefox and Chrome (at least) slidebox

ryhcu404 commented 7 years ago

I've found the culprit and a workaround, although I'm not sure of the repurcussions (I've not found any so far). To get this working (for at least Chrome, Firefox, IE, and Android in-app browser), comment out the line "tot = fixer;" as follows in the slidebox js file:

        _sbox_pos: function() {
            var fixer, ech, top, par, tot, w = this;
            w.d.intHTML.find("div.ui-datebox-sliderow-int").each(function() {
                ech = $(this);
                par = ech.parent().outerWidth();
                fixer = ech.outerWidth();
                if (w.__("isRTL")) {
                    top = ech.find("div").last();
                } else {
                    top = ech.find("div").first();
                }
                tot = ech.find("div").length * top.outerWidth();
                if (fixer > 0) {
                    //tot = fixer;
                }
                top.css("marginLeft", (tot - par) / 2 * -1);
            });
        },
jtsage commented 7 years ago

Any repercussions on this? (I don't honestly know what that bit does anymore. I know, I know, comments in code). My guess is it was an edge case anyway, which is now working the other way. In particular, does it bone IOS?

ryhcu404 commented 7 years ago

We've been running this workaround in production for several weeks now with no issues found. (We had personally tested on numerous iOS and Android devices.) I was not able to determine what fringe case the "fixer" line was for, but I know the slidebox was unusable without the fix on both iOS and Android.

jtsage commented 7 years ago

rock on. I'll drop that on in next time I have a chance. Thanks.

jtsage commented 7 years ago

This is in. SHA: a478baf26c957e8c72f2c76aa360e6d9c7287782

Thanks!