javascriptjquerytwitter-bootstrapdatepickeroff-canvas-menu

Bootstrap offcanvas prevent closing of offcanvas when you click on datepicker


I am having problems with offcanvas menu closing when i use datepicker in form inside menu and click on datepicker button.

I've been busting my head for last 2 days but i can't make a fix for it and everywhere i searched i didn't find solution.

I am using jquery ui and datepicker in combination with bootstrap offcanvas from iamphill

https://github.com/iamphill/Bootstrap-Offcanvas

I have some inputs in offcanvas menu and datepicker field on one input, and when i open menu and click on any date or previous/next on datepicker, offcanvas menu closes it self.

Code is very long to paste here so i made codepen example

https://codepen.io/lonerunner/full/dapzNX

If you take a look, you will see small black square in right corner, when you click on square, offcanvas menu will open and on third input field is datepicker, when you click datepicker will open and if you click on next month, offcanvas menu will close.

If anyone have idea how to prevent close i would gladly appreciate it.


Solution

  • What also works is to change following code to make it not close on the datepicker:

    Line 253

      Offcanvas.prototype._documentClicked = function(e) {
        if($('.ui-datepicker').is(':visible')) {
            return;
        }