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

mouseleave event handler returns false and prevents event propagation #1055

Closed
BrandonLWhite opened this issue Feb 22, 2013 · 2 comments
Closed

Comments

@BrandonLWhite
Copy link
Contributor

Fighting with this in 0.9.11 (jQuery). Why does chosen need to "return _this.mouse_leave(evt);" from the mouseleave event handler setup in Chosen.prototype.register_observers? The result is always false, due to:

AbstractChosen.prototype.mouse_leave = function() {
  return this.mouse_on_container = false;
};

This causes jQuery to StopPropagation, thus any parent elements will not get their mouseleave invoked. This is causing me grief (tooltip sort of stuff, FWIW).

If I eliminate the "return" then everything is cool. I'm scratching my head trying to figure out why its there to begin with. Can someone fix this? Or if it's as-designed please help me understand the purpose.

@BrandonLWhite
Copy link
Contributor Author

Ok I get the 'why' now. It's the default Coffescript behavior to return the last expression from the function. You have to manually opt-out return values in Coffescript. Thus to resolve the issue, in abstract-chosen.coffee add a "return" to specify to return undefined. This probably should be applied to other event handlers as well.

mouse_leave: -> @mouse_on_container = false; return

If you guys will accept a pull request I'm happy to make the change.

@stof
Copy link
Collaborator

stof commented Feb 22, 2013

yeah, please send a PR doing it for all event handlers to avoid issues

stof added a commit that referenced this issue Mar 6, 2013
@stof stof closed this as completed Mar 6, 2013
pfiller added a commit that referenced this issue Apr 19, 2013
Better container reference #1151
Fix issue when destroying last choice #1149
Use selectedIndex for tracking change events. #1147
Better IE Disabling #1144
Dropdown use css positioning for top position #1143
Fix bug when deleting last item #1142
Percentage Width Support #1141
CSS Centering Fix #1120
Use New CoffeeScript #1125
Chosen License #1111
Update placeholder text with ``liszt:updated`` #1107
Fix strange event bubbling #1055
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