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

Stop bubbling up events when removing a choice #3853

Closed
wants to merge 1 commit into from
Closed

Stop bubbling up events when removing a choice #3853

wants to merge 1 commit into from

Conversation

piotr-cz
Copy link

Fixes #3209

I've tried also changing the original click event listener to exclude .select2-selection__choice__remove child, but I didn't figure how.

Anyway preventing event to bubble up to main container seems to be cleaner solution.

We are using Select2 as a filter in SPA when changing options triggers re-rendering view with filtered items. When options is removed, options container opens up and when view re-renders options container jumps out to upper left corner and detaches itself from main container.

By the way: what about a new release?

@kevin-brown
Copy link
Member

With 4.0.0 we're trying our best to avoid breaking backwards compatibility in the future, and we actually designed how events propagate to allow for others to pick and choose how they want Select2 to work. This was one of those places, which is why originalEvent is being passed into the select2:unselect event.

Anyway preventing event to bubble up to main container seems to be cleaner solution.

I definitely agree, and luckily you can do this without modifying the Select2 core as seen in #3209 (comment).

By the way: what about a new release?

Working on it, I've been pretty busy in the last month with non-FOSS things.

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

Successfully merging this pull request may close these issues.

2 participants