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

'active' class is only applied when liveSearch is on #1110

Closed
andrews05 opened this issue Jul 28, 2015 · 7 comments
Closed

'active' class is only applied when liveSearch is on #1110

andrews05 opened this issue Jul 28, 2015 · 7 comments
Assignees
Milestone

Comments

@andrews05
Copy link

On a non-multiple select, the selected li in the dropdown menu is given the class 'active' (which highlights it blue) if and only if liveSearch is on. Not sure if this is a bug or intentional but I would think the 'active' class should be applied regardless of search.

@caseyjhol
Copy link
Member

This is intentional. When a select doesn't have liveSearch enabled, the selected option is focused. When liveSearch is enabled, the active class must be used, as the focus needs to remain on the input. So, you could modify your .dropdown-menu>li>a:focus styling to match that of .active.

When bootstrap-select was first released, the liveSearch option didn't exist, so this is a remnant to keep "normal" selects (without liveSearch enabled) consistent with older versions of bootstrap-select. However, at this point, it would probably make more sense to always apply the active class to keep styling consistent. @t0xicCode @silviomoreto thoughts?

@andrews05
Copy link
Author

Ah yup, I understand what you're saying. I just think it should be consistent either way. In my case I'm activating liveSearch on my selects when they have more than a certain number of options, which means they can change from time to time if the number of options changes. The difference in appearance confused me for a long time until I tracked down what the cause was.

A possibly related issue: When using the liveSearch (i.e. typing in it) there's no longer anything to indicate the currently selected item, even if you delete what you've typed and the whole menu returns (this isn't an issue with multiple selects as the tick mark is persistent). In practice it isn't really a big deal but just thought I'd mention it.

@silviomoreto
Copy link
Collaborator

I agree with you @caseyjhol! We should keep the coherency in both cases.

Although, I think that we should keep the focus on the input of liveSearch when the dropdown is open. If we just change the .active class placement it will lose the focus for the selected option in the dropdown.

@t0xicCode
Copy link
Collaborator

Same. We've had liveSearch for a while now, so I think we should be fine to replace the old behaviour with a consistent one.

@caseyjhol caseyjhol self-assigned this Mar 6, 2017
@Gatunox
Copy link

Gatunox commented May 6, 2017

Same issue here

@caseyjhol caseyjhol added this to the v1.13.0 milestone Jul 12, 2017
@caseyjhol
Copy link
Member

Available in v1.13.0-alpha.

@y1n0
Copy link

y1n0 commented Dec 20, 2019

I am getting .active on bs-select element on initialization, even if it was not touched. is this expected?

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

6 participants