Skip to content

Commit

Permalink
Fix forever calendar prev/next when disabled form element beneath, an…
Browse files Browse the repository at this point in the history
…d on a 6 week month
  • Loading branch information
sitecode authored Sep 28, 2024
1 parent 5f9f524 commit 53c3e28
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jquery.datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 53c3e28

Please sign in to comment.