wvega / timepicker

A jQuery plugin to enhance standard form input fields helping users to select (or type) times
http://timepicker.co
GNU General Public License v2.0
216 stars 93 forks source link

Clicking time option in dropdown does not populate field if you hold the mouse button down too long #50

Closed tom0dea closed 8 years ago

tom0dea commented 9 years ago

Some of our users reported this issue and I found out that they are holding the mouse button down too long after clicking on a time entry. If you hold the mouse button down for about a second or more then the field will not populate. A quick click of the time populates the field.

wvega commented 9 years ago

@pratie thank you for reporting this issue. I'll take a look at it this weekend.

Do you have information about the browsers or OS that are affected?. I haven't tried it out yet, but I ask just in case I have problems reproducing it.

tom0dea commented 9 years ago

I have seen the issue on Windows using following browsers: Chrome (version 37.0.2062.124 m) Firefox (version 32.0.3) Internet Explorer (version 9.0.8112)

tom0dea commented 9 years ago

To workaround this issue for now I changed the bind event from click to mousedown. line #389 of current version: }).bind('click.timepicker', function(event) {

wvega commented 9 years ago

@pratie, thank for all the info. I'll make sure to binding to mousedown s a solution when I start working on this issue.

michelgallant commented 8 years ago

I know the library seems to be abandoned, but I love it. In response to the fix by @pratie earlier, the same change needs to be done to line 58.

KadriV commented 8 years ago

I am also using this library and I am loving this.. But the same problem with this issue :(

wvega commented 8 years ago

Hi everyone, thanks for you patience and the kind words.

I'm having a hard time trying to reproduce this issue. I tested using Chrome on a Mac and IE 11 on Windows 8.1. I'm going to need help, so I have a couple of questions:

  1. How long is too long? How long do I have to hold down the mouse button in order to reproduce the problem?
  2. Both @pratie and @michelgallant seem to agree that changing the event from click to mousedown fixes the problem. Is that right?

    If that's the case, I may consider using mousedown as solution, even though I can't reproduce the problem, as long as that change doesn't cause other problems.

  3. Maybe I'm not testing with the right settings. @KadriV, can you share here the code you are using to initialise the plugin?
  4. What version of jQuery are you using?
wvega commented 8 years ago

I just created a modified version of jQuery Timepicker 1.3.2 that uses the mousedown event instead of click.

The minified version can be downloaded from https://gist.github.com/wvega/afe692897338747a8f91df566d50a57a.

@KadriV could you please give that file a try and let me know if that fixes this issue for you?

KadriV commented 8 years ago

Hello! Thank you so much for answering!

First about the bug. This is a kind of bug that happens depending on the user who uses the mouse. I actually didn't manage to recreate the problem after I sat down with one person who complained about it. For example I always manage to populate the input field because I make sharp and short mouse clicks. It doesn't populate if mouse slightly moves a few pixels during the click. So the length of the mouse click is actually not a problem. If the mouse moves in between the mousedown and mouseup - that is the problem.

I found this problem everywhere I tested - Chrome and Firefox in Linux and Windows. jQuery version is 1.7.2(I know it's old one.. )

I tested this new version and it really does fix the bug, but it also creates a new bug. After selecting a time from drop-down the input stays focused. Before it didn't. If it is focused I cannot reopen the dropdown again until I manually click elsewhere so that the input wouldn't be focused.

Thanks again! I hope this helps :)

wvega commented 8 years ago

@KadriV thank you for all that information. It is very helpful.

I think I saw the problem with moving the cursor between the mousedown and mouseup events as well, so that's something I can reproduce and work with.

I tried clicking links in this page, for example, and if you move the cursor enough to be out of the original clicking area, the click doesn't seem to register. I guess that's what is happening with the time picker. Using mousedown instead of click seems to be the way to go then.

I'll look into the focus problem you mentioned and once that's fixed too, I'll push a new version.

Thank you for your help :)

wvega commented 8 years ago

The modifications to fix this problem are now part of jQuery Timepicker 1.3.3.

Thank you @KadriV, @pratie and @michelgallant for your help debugging and testing the solution for this issue.

KadriV commented 8 years ago

@wvega Thank you!

KadriV commented 8 years ago

@wvega Can you please also update the npm-package to the latest release? :)

wvega commented 8 years ago

@KadriV just did it. Thanks!