No ctrl/command click when for single selects.

abstract-chosen
Patrick Filler 2011-08-08 11:37:56 -04:00
parent d6137ad5be
commit 528d77bc04
7 changed files with 16 additions and 12 deletions

View File

@ -424,7 +424,7 @@
} else {
this.selected_item.find("span").first().text(item.text);
}
if (!evt.metaKey) {
if (!(evt.metaKey && this.is_multiple)) {
this.results_hide();
}
this.search_field.val("");
@ -626,6 +626,8 @@
case 38:
case 40:
case 16:
case 91:
case 17:
break;
default:
return this.results_search();

File diff suppressed because one or more lines are too long

View File

@ -416,7 +416,7 @@
} else {
this.selected_item.down("span").update(item.html);
}
if (!evt.metaKey) {
if (!(evt.metaKey && this.is_multiple)) {
this.results_hide();
}
this.search_field.value = "";
@ -633,6 +633,8 @@
case 38:
case 40:
case 16:
case 91:
case 17:
break;
default:
return this.results_search();

File diff suppressed because one or more lines are too long

View File

@ -360,8 +360,7 @@ class Chosen
else
@selected_item.find("span").first().text item.text
if not evt.metaKey
this.results_hide()
this.results_hide() unless evt.metaKey and @is_multiple
@search_field.val ""
@ -523,7 +522,7 @@ class Chosen
this.result_select(evt) if this.results_showing
when 27
this.results_hide() if @results_showing
when 9, 38, 40, 16
when 9, 38, 40, 16, 91, 17
# don't do anything on these keys
else this.results_search()
@ -531,7 +530,7 @@ class Chosen
keydown_checker: (evt) ->
stroke = evt.which ? evt.keyCode
this.search_field_scale()
this.clear_backstroke() if stroke != 8 and this.pending_backstroke
switch stroke

View File

@ -355,8 +355,7 @@ class Chosen
else
@selected_item.down("span").update(item.html)
if not evt.metaKey
this.results_hide()
this.results_hide() unless evt.metaKey and @is_multiple
@search_field.value = ""
@ -523,7 +522,7 @@ class Chosen
this.result_select(evt) if this.results_showing
when 27
this.results_hide() if @results_showing
when 9, 38, 40, 16
when 9, 38, 40, 16, 91, 17
# don't do anything on these keys
else this.results_search()

View File

@ -50,6 +50,7 @@
<link rel="stylesheet" href="chosen/chosen.css" />
</head>
<body>
<form>
<div id="container">
<h1>Chosen</h1>
<p>Chosen is a JavaScript plugin for Prototype and jQuery that makes long, unwieldy select boxes much more user-friendly. For more information (including usage, explanation and faqs), check out the <a href="http://harvesthq.github.com/chosen/">online documentation</a>.</p>
@ -1188,7 +1189,7 @@
</div>
<div>
<em>Multiple Select with Groups</em>
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chzn-select" tabindex="8">
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chzn-select" id="test_me" name="test_me_form" tabindex="8">
<option value=""></option>
<option>American Black Bear</option>
<option>Asiatic Black Bear</option>
@ -1271,4 +1272,5 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript"> $(".chzn-select").chosen(); </script>
</form>
</body>