From 5f9f5248cc5a69ae35e7a0f082dfcc56641bbc48 Mon Sep 17 00:00:00 2001 From: sitecode Date: Sat, 28 Sep 2024 16:54:05 -0400 Subject: [PATCH 1/2] Allow mobile auto repeat for prev/next buttons --- jquery.datetimepicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 89fdfff5..9088e7d1 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -1609,7 +1609,7 @@ var datetimepickerFactory = function ($) { }); month_picker .find('.xdsoft_prev,.xdsoft_next') - .on('touchend mousedown.xdsoft', function () { + .on('touchstart mousedown.xdsoft', function () { var $this = $(this), timer = 0, stop = false; @@ -1636,7 +1636,7 @@ var datetimepickerFactory = function ($) { timepicker .find('.xdsoft_prev,.xdsoft_next') - .on('touchend mousedown.xdsoft', function () { + .on('touchstart mousedown.xdsoft', function () { var $this = $(this), timer = 0, stop = false, From 53c3e2898ee2ae84ac87e5f9a92a4f1188196ce0 Mon Sep 17 00:00:00 2001 From: sitecode Date: Sat, 28 Sep 2024 17:15:57 -0400 Subject: [PATCH 2/2] Fix forever calendar prev/next when disabled form element beneath, and on a 6 week month --- jquery.datetimepicker.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 9088e7d1..7cec1d6d 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -2264,6 +2264,16 @@ var datetimepickerFactory = function ($) { } else { datetimepickerCss[verticalAnchorEdge] = verticalPosition; } + /** + * Fixes a bug which happens if: + * clicking prev/next while viewing a 6 week month adjusts the height of the calendar to less + * for the prev/next month with 5 only weeks, in which case **when the popup is above the input** by the + * time the mouseup event occurs the prev/next button is no longer underneath the mouse pointer, rather + * whatever was behind the calendar popup, and if that whatever is also a disabled form element then + * the mouseup event is swallowed up and the prev/next repeat becomes an infinite loop. + * One solution is set a fixed height, so that the UI doesn't jump around for better UX when above. + */ + calendar.css({'min-height':verticalAnchorEdge == 'bottom' ? '180px' : ''}) datetimepicker.css(datetimepickerCss); };