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

Toggles do not work always #164

Open
cyberbeat opened this issue Jun 23, 2015 · 0 comments
Open

Toggles do not work always #164

cyberbeat opened this issue Jun 23, 2015 · 0 comments

Comments

@cyberbeat
Copy link

In following cases toggles don't work:

<a id="toggle">Some text <img src="someimage.png"/></a>

there is no event.preventDefault, when clicking on the img, so the page is reloaded

<div id="toggle">Some text <img src="someimage.png"/></div>

In this case, the calendar cannot be closed not at all.

The problematic code is on both cases picker.atach.js:

in first case event.stop(); is not executed:, because tag = img

var getOpenEvent = function(element){
return function(event){
var tag = event.target.get('tag');
if (tag == 'input' && event.type == 'click' && !element.match(':focus') || (self.opened && self.input == element)) return;
if (tag == 'a') event.stop();
self.position(element);
self.open();
self.fireEvent('attached', [event, element]);
};
};

in second case the close function has no effect, because here isA is always false

var closeEvent = function(event){
var stopInput = self.options.blockKeydown
&& event.type == 'keydown'
&& !(['tab', 'esc'].contains(event.key)),
isCloseKey = event.type == 'keydown'
&& (['tab', 'esc'].contains(event.key)),
isA = event.target.get('tag') == 'a';

        if (stopInput || isA) event.preventDefault();
        if (isCloseKey || isA) self.close();
    };
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

1 participant