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

Remove .active class on items when removed with the X from remove_button plugin #1216

Closed
Trinitonn opened this issue Dec 7, 2016 · 5 comments

Comments

@Trinitonn
Copy link

Trinitonn commented Dec 7, 2016

Hi,

Thank you for a great plugin!

I encountered a situation using the remove_button plugin. When you press the X-icon on a selected item it removes the item from the selected list, however it does not remove the .active class on this element.

Try this by:
Add multiple items
Click on one of them so it gets the .active class
Remove the active one by pressing the X-icon
Select another item in the already selected item list, so that one gets the .active class
Reselect the item you removed by using the X-icon

You will end up with two items which both are .active.

This is no bug, but the behavior is unexpected for me as an end user. For my case is just added a removeClass in the removeItem function like this:

if ($item.hasClass('active')) { idx = self.$activeItems.indexOf($item[0]); self.$activeItems.splice(idx, 1); $item.removeClass('active'); }

@joallard
Copy link
Member

Is this related to #1212?

@Trinitonn
Copy link
Author

Trinitonn commented Dec 16, 2016

Hi, I just read #1212 and tested this issue as well, and can confirm they are related.

Using "Delete" or "Backspace" on a selected item is causing the same behavior as using the X-icon: the .active class will not be removed.

I also tried the patch mentioned by @quintstoffers in #1212, but it's not working for me.

The change I did just to get it work for me, will also work for solving #1212.

@quintstoffers
Copy link

@Trinitonn Did you add the plugin to the array of plugins passed to your selectize call?

@Trinitonn
Copy link
Author

Trinitonn commented Dec 21, 2016

@quintstoffers Yes, I did add the plugin to the array and I also added an alert into your plugin to confirm it's running. By the way, I'm using the standalone version:
https://github.com/selectize/selectize.js/tree/master/dist/js/standalone

sustmi added a commit to sustmi/selectize.js that referenced this issue Jun 20, 2018
sustmi added a commit to sustmi/selectize.js that referenced this issue Jun 20, 2018
sustmi added a commit to sustmi/selectize.js that referenced this issue Nov 12, 2018
sustmi added a commit to sustmi/selectize.js that referenced this issue Nov 12, 2018
@risadams
Copy link
Contributor

closing stale issues older than one year.
If this issue was closed in error please message the maintainers.
All issues must include a proper title, description, and examples.

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

4 participants