-
Notifications
You must be signed in to change notification settings - Fork 618
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
selectedState does not exist #637
Comments
Hey there, any update on this? |
@jshjohnson Do you want that to be implemented or removed from documentation? |
I think it can be removed - I don't see any distinction between this and the |
It most assuredly cannot. |
@St-Permiakov you could use the 'highlighted' state for that situation |
@jshjohnson At this moment it isn't implemented or i'm missing someting? |
@mroseboom it's not implemented in code base in current version. |
Does it appear on selected item without user hovering it? |
@jshjohnson the implementation will be trivial and I can easily add that, however, @St-Permiakov use case probably will anyway require overriding template rendering. Is that feature were never implemented or were removed in past version without updating documentation? |
Well, the only reason why I created this issue was impossibility to distinguish hovered and selected states for styling. That's what that selectedState was supposedly for. If there is any other way... |
@St-Permiakov with Choices 8 released today: const example = new Choices(element, {
callbackOnCreateTemplates: () => ({
item(classes, item) {
const i = Choices.defaults.templates.item.call(this, classes, item);
if (item.selected) i.classList.add("is-selected");
return i;
},
// or
choice(classes, choice) {
const i = Choices.defaults.templates.choice.call(this, classes, choice);
if (choice.selected) i.classList.add("is-selected");
return i;
}
})
}); |
@tinovyatkin For me works the second example with a It would be better if it worked without a workaround |
@stasguma glad it works for you, fixed an example, thank you! |
I've addressed this bug here: #754 - note only a "choice" has a "selected" state. An item does not 👍 |
Related to #367
As stated there, selectedState css-class does not appear on selected option.
So either documentation is incorrect or it's a bug.
The text was updated successfully, but these errors were encountered: