Skip to content

Unable to close the menu when clicking on HTML tag or BODY tag #293

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

Closed
Romanow88 opened this issue Feb 27, 2013 · 15 comments
Closed

Unable to close the menu when clicking on HTML tag or BODY tag #293

Romanow88 opened this issue Feb 27, 2013 · 15 comments

Comments

@Romanow88
Copy link

Please add this fix to the code:

        $( document ).bind( "mousedown.selectmenu-" + this.ids[ 0 ], function( event ) {
            //check if open and if the clicket targes parent is the same
            if (!event.target.offsetParent) {
                self.close(event);
                return;
            }
            if ( self.isOpen && self.ids[ 1 ] != event.target.offsetParent.id ) {
                self.close( event );
            }
        });
@fnagel
Copy link
Owner

fnagel commented Mar 2, 2013

Please post an example, see #61

@fnagel
Copy link
Owner

fnagel commented Mar 26, 2013

Any feedback on this issue?

@Romanow88
Copy link
Author

Hi, don't know if I can reproduce this in jsfiddle, but it reproduses in ie9 and chrome on win7, win server 2003, 2007. Basically if you click on the body element when you have the drop down open you have a exception, saying that offsetparent is undefined. Hope this helps.

@fnagel
Copy link
Owner

fnagel commented Mar 27, 2013

I cant reproduce it with default demo. I would need a minimal demo here.

@rosieks
Copy link

rosieks commented May 28, 2013

I have the same issue when I click on body element (event.target is HTMLBodyElement). Value of HTMLBodyElement's offsetParent property is null.

@fnagel
Copy link
Owner

fnagel commented May 28, 2013

Again: please post a minimal demo.

@rosieks
Copy link

rosieks commented May 28, 2013

Here you are: http://jsfiddle.net/fnagel/GXtpC/embedded/result/
Just click on bottom of page (make sure that event.target is BODY and not DIV) when menu is opened. The problem occurs on IE9, IE10, Chrome 27

@Romanow88
Copy link
Author

That's what I was talking about.

@fnagel
Copy link
Owner

fnagel commented May 28, 2013

Oh, shit. Thats a bad one.

Problem confirmed, even in latest FF.

@fnagel
Copy link
Owner

fnagel commented May 28, 2013

Problem is related to this one: #300

@fnagel
Copy link
Owner

fnagel commented May 28, 2013

I've fixed this by reverting an old commit. Thanks for reporting!

Please check latest commit and give feedback!
Hopefully we'll not run into problems like this as the new Selectmenu has a bunch of unit tests.

@zalog
Copy link

zalog commented May 29, 2013

But now it work only when clicking on the html tag outside our html elements.
http://jsfiddle.net/fnagel/GXtpC/

@fnagel
Copy link
Owner

fnagel commented May 29, 2013

Problem confirmed. Ive adopted the if clause we use in the new version. Works nice.

Please test and give feedback!

@zalog
Copy link

zalog commented May 30, 2013

Works like a charm 👍

@fnagel
Copy link
Owner

fnagel commented Sep 7, 2013

Closed as fixed.

@fnagel fnagel closed this as completed Sep 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants