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

Pressing enter or escape when no field is bound will cause an error #611

Closed
jsgoupil opened this issue Nov 17, 2016 · 3 comments
Closed

Comments

@jsgoupil
Copy link

This code will cause the pikaday throw an error when no fields has been attached to the pikaday.

Cannot read property 'blur' of null

switch(e.keyCode){
    case 13:
    case 27:
        opts.field.blur();

https://github.com/dbushell/Pikaday/blob/master/pikaday.js#L489

@inzerceubytovani
Copy link

Same problem here

@josundt
Copy link

josundt commented Dec 21, 2016

Same problem here. After upgrading to latest Pikaday release, lots of exceptions are logged in our application due to this. We had to revert to previous version. Should be a very easy fix, so I will create a pull request.

@barneycarroll
Copy link

You can get around this without any ostensible side-effects by chucking in an otherwise useless input after initialisation:

var picker = new Pikaday(options);

picker._o.field = document.createElement('input');

@rikkert rikkert closed this as completed Jun 7, 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

5 participants