Skip to content

Commit 965c759

Browse files
committed
Fix some key press behaviors
1 parent f7141ae commit 965c759

File tree

7 files changed

+27
-10
lines changed

7 files changed

+27
-10
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-selectric",
33
"description": "Fast, simple and light jQuery plugin to customize HTML selects",
4-
"version": "1.7.1",
4+
"version": "1.7.2",
55
"keywords": [
66
"select",
77
"selectbox",

dist/jquery.selectric.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* /,'
1010
* /'
1111
*
12-
* Selectric Ϟ v1.7.1 - http://lcdsantos.github.io/jQuery-Selectric/
12+
* Selectric Ϟ v1.7.2 - http://lcdsantos.github.io/jQuery-Selectric/
1313
*
1414
* Copyright (c) 2014 Leonardo Santos; Dual licensed: MIT/GPL
1515
*
@@ -243,8 +243,13 @@
243243

244244
// Behavior when system keys is pressed
245245
function _handleSystemKeys(e) {
246+
var key = e.keyCode || e.which;
247+
248+
if ( key == 13 )
249+
e.preventDefault();
250+
246251
// Tab / Enter / ESC
247-
if ( /^(9|13|27)$/.test(e.keyCode || e.which) ) {
252+
if ( /^(9|13|27)$/.test(key) ) {
248253
e.stopPropagation();
249254
_select(selected, true);
250255
}

dist/jquery.selectric.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,13 @@ <h2>Browser support</h2>
425425

426426
<h2>Demo</h2>
427427

428+
<select>
429+
<option value="">Select with few options</option>
430+
<option value="apple">Apple</option>
431+
<option value="banana">Banana</option>
432+
<option value="orange">Orange</option>
433+
</select>
434+
428435
<select>
429436
<option value="">Select with big option mauris nec orci ut tortor consectetuer dapibus mauris nec orci ut tortor consectetuer dapibus</option>
430437
<option value="apple">Apple</option>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "jquery-selectric",
3-
"version": "1.7.1",
3+
"version": "1.7.2",
44
"devDependencies": {
55
"grunt": "~0.4.5",
6-
"grunt-contrib-uglify": "~0.4.0",
6+
"grunt-contrib-uglify": "~0.5.1",
77
"grunt-banner": "~0.2.2",
88
"grunt-contrib-copy": "~0.5.0",
9-
"grunt-sass": "~0.12.1",
9+
"grunt-sass": "~0.14.0",
1010
"grunt-cssbeautifier": "~0.1.1",
1111
"grunt-jquerymanifest": "~0.1.4"
1212
}

selectric.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selectric",
3-
"version": "1.7.1",
3+
"version": "1.7.2",
44
"title": "jQuery Selectric",
55
"author": {
66
"name": "Leonardo Santos",

src/jquery.selectric.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@
226226

227227
// Behavior when system keys is pressed
228228
function _handleSystemKeys(e) {
229+
var key = e.keyCode || e.which;
230+
231+
if ( key == 13 )
232+
e.preventDefault();
233+
229234
// Tab / Enter / ESC
230-
if ( /^(9|13|27)$/.test(e.keyCode || e.which) ) {
235+
if ( /^(9|13|27)$/.test(key) ) {
231236
e.stopPropagation();
232237
_select(selected, true);
233238
}

0 commit comments

Comments
 (0)