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

Event hide.bs.select not fired when Esc pressed with live search configuration #1489

Closed
meesha81 opened this issue Aug 29, 2016 · 3 comments
Closed
Labels

Comments

@meesha81
Copy link

Hi,

event hide.bs.select not fired when Esc pressed with live search configuration.

This differs to select WITHOUT live search which fires the event as expected.

Best regards,
Michal

@meesha81
Copy link
Author

meesha81 commented Sep 1, 2016

Hi,
thank you for fast bug fix.

I have tested your solution and here is the feedback:

Event is now fired, but there is still difference between live search configuration and without it.

Without live search:

  • key 27 (Esc) IS NOT propagated

With live search:

  • key 27 Esc IS still propagated

I have fixed this issue in the js file and here is the patch which.

bootstrap-select.js

@@ -1635,6 +1635,10 @@
}
if (that.options.liveSearch) {
+        if (/^27$/.test(e.keyCode.toString(10)) && isActive) {
+           e.stopPropagation();
+        }
+          
if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) {
e.preventDefault();
that.$button.click().focus();

It should work properly.

Best regards,
Michal Vrabel

caseyjhol added a commit that referenced this issue Sep 9, 2016
@ghost
Copy link

ghost commented Nov 2, 2016

The change in ead67e5 breaks behaviour of selectOnTab = true.
It makes .active the original option so later wrong option is picked at line 1750

@meesha81
Copy link
Author

meesha81 commented Aug 2, 2017

Hi, currently tab select option and close livesearch. But original select behavior is:
select option, close live search and DO TAB to next form item.

avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants