Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blur event resumes the timer again #77

Closed
nWidart opened this issue Dec 5, 2016 · 1 comment
Closed

Blur event resumes the timer again #77

nWidart opened this issue Dec 5, 2016 · 1 comment

Comments

@nWidart
Copy link

nWidart commented Dec 5, 2016

Hello,

In current behaviour, once the timer was started + paused, when leaving the input field, it resumes the timer.

Steps to reproduce on jquerytimer.com :

  • click "start timer"
  • wait couple of seconds
  • click "pause"
  • Put cursor in input
  • Leave the input field

Result: timer resumes

Is there a way to not have this behaviour ? Ie: leaving the input doesn't resume the timer ?

Thanks!

Edit: even with the following code it doesn't resume the timer on blur.

$timer.on('blur', function() {
    if(hasTimer) {
        $timer.timer('pause');
    }
});

Edit 2:

Found what was causing the blur event: https://github.com/walmik/timer.jquery/blob/master/src/utils.js#L218 but it doesn't look to be configurable.

@walmik
Copy link
Owner

walmik commented Dec 6, 2016

@nWidart

Thank you for observing this!

However, please note, this is not a bug/issue in the timer plugin itself. The plugin provides a convenience method for quickly wiring up the focus and blur events on the timer by setting the editable property as true. This creates these events and it's useful when you don't have any buttons to pause/resume the timer. There was some confusion around this in issue #40 as well.

I'd say this is an issue in jquerytimer.com's implementation of the pause/resume functionality. Looks like it's not in sync with the editable property set on the timer.

I will fix this once I get some time. Thanks again!

@walmik walmik closed this as completed Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants