chingyawhao / materialize-clockpicker

A materialize clockpicker, demo on
http://chingyawhao.github.io/materialize-clockpicker.html
MIT License
140 stars 69 forks source link

Chrome 73 mouseup disappear issue #40

Open warmwhisky opened 5 years ago

warmwhisky commented 5 years ago

When clicking the input with mousedown, the clock picker pops up but on mouseup it disappears.

renan-taranto commented 5 years ago

I'm having the same issue @warmwhisky. Did you figure it out how to solve it?

itsmanuelrc commented 5 years ago

same problem here. Did you find any workaround?

nullnullru commented 5 years ago

The same, has anybody found a fix of the problem?

warmwhisky commented 5 years ago

I found these guys had the same issue in their docs with there implementation of the clock picker. They have fixed it, but I could not figure out what had been done. mdbootstrap/bootstrap-material-design

renan-taranto commented 5 years ago

I solved it by using an afterShow function like this:

afterShow: function() {
  setTimeout(() => {
    $(".collectTime .clockpicker").addClass('picker--opened')
    $(".collectTime .clockpicker").show();
  }, 50);
}

It's an ugly workaround but solved the issue. I did it before I found the probably related https://github.com/amsul/pickadate.js/issues/1138 which solved the same issue I had with the pickadate.

nicomelchiori commented 5 years ago

Same problem here. Weird thing is that works fine if you use secondary mouse button.

dinhdu2704 commented 5 years ago

The same, Has anyone found a fix the problem?

nullnullru commented 5 years ago

kaideptrai1102, you can try the renan-teranto's solution, it works but looking not so good :) Anyway it's better than nothing.

FcoSuastegui commented 5 years ago

I found a solution to this problem, adding one more condition to the if () but clicking on the other side of the modality of the datepicker does not close the datepicker, only if the close button is added

if ( ! event.isSimulated && target != ELEMENT && target != document && event.which != 3 **&& event.which != 1** ) {
                // If the target was the holder that covers the screen,
                // keep the element focused to maintain tabindex.
                P.close( target === P.$holder[0] )
            }
dinhdu2704 commented 5 years ago

By somehow, I added target.classList.contains('pickerholder' ) to the condition if(), so now I can click outside to close datepicker, it's working perfectly fine :) ` if (target.classList.contains('pickerholder') && target != ELEMENT && target != document && event.which !== 3 ) { // If the target was the holder that covers the screen, // keep the element focused to maintain tabindex. P.close( target === P.$root.children()[0] ) } `

For clocktime picker, You have to find this line 0===i.closest(e.popover.find(".picker__wrap")).length&&0===i.closest(e.input).length&&e.hide() And replace it to 0===i.closest(e.popover.find(".picker__wrap")).length&&0===i.closest(e.input).length&&i[0].classList.contains('picker__holder')&&e.hide()

vikasthriwe commented 1 year ago

This Is Working For Me... $('.datepicker').on('mousedown',function(event){ event.preventDefault(); })