Skip to content

remove_button plugin closes bootstrap dropdown #870

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
sylido opened this issue Aug 4, 2015 · 3 comments
Closed

remove_button plugin closes bootstrap dropdown #870

sylido opened this issue Aug 4, 2015 · 3 comments

Comments

@sylido
Copy link

sylido commented Aug 4, 2015

I have a bootstrap dropdown which contains a form, one of the input elements is a selectize input text on which I wanted tags. Addings tags worked nicely, then came the time to remove them by clicking the x button on the right, added byt he remove_button plugin. When doing that, the whole dropdown would get triggered and the whole form would get hidden.

There is no easy way to control the events as they are closed off, the only solution I could find was to "rewrite" the plugin, doing e.stopPropagation(); just before `e.preventDefault();' in the click event handler. This works, but why isn't it the default in order to avoid situations like that ?

I figure it's something to do with closing the typeahead dropdown that shares bootstrap dropdown classes. Is there a better way to avoid this happening ?

@sspread
Copy link

sspread commented Jun 7, 2016

I have the same issue. The remove button on tags closes my Foundation Reveal modal. My hack solution edits source code by adding return false; to remove_button click handler.

@msevcenko
Copy link

+1 on this one. Is there a chance this gets fixed?

I think that stopPropagation or returning false from the handler is the correct solution. We want to mark the event as consumed so it should not bubble to parent elements. Are there some drawbacks of this fix?

There is also one unfortunate circumstance - at the time the event bubbles, the element that caused the event (event.target) is already removed from the DOM. Dialogs usually test that when user clicked inside the dialog, the dialog should not close. This test however fails because the target element is no longer in the dialog.

The workaround thus might be that dialog also should not close when target element is no longer in the DOM, this however requires modifying the dialog logic.

@sylido
Copy link
Author

sylido commented Feb 19, 2020

@msevcenko this will never get fixed as the issue is 5 years old, you should make a separate branch with the change that risadams made in his branch. Closing this as selectize seems dead.

@sylido sylido closed this as completed Feb 19, 2020
risadams added a commit that referenced this issue Nov 3, 2020
Fix for #851 - Placeholder text clipping
Fixed issue #870, remove_button plugin closing bootstrap modals
risadams added a commit that referenced this issue Nov 3, 2020
Fix for #851 - Placeholder text clipping
Fixed issue #870, remove_button plugin closing bootstrap modals
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

3 participants