From eca9247e0bccc6376ec6ec6641e07fcaf149e4d3 Mon Sep 17 00:00:00 2001 From: aetna-softwares Date: Thu, 28 Jun 2018 16:02:44 +0200 Subject: [PATCH] Don't use Tab as select key Use Tab as select key has 2 problems : 1/ normal select : enter the select, use arrow to select an option, use TAB to go out the option is selected (this could be discussed but why not) then go back to the field use arrow to go to the selected option and use TAB to go out : the option is deselected. This is obviously not want the user want to do 2/ multiple select : the problem here is that the code assume that the selected option is the highlighted value but in case of multiple it is an array of indexes and then the select() code crash because it assume that only an index is given I think that Enter/Space is enough for selection. Removing Tab from select keys remove these side effect and I feel the behaviour quite confortable --- src/jquery.selectric.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jquery.selectric.js b/src/jquery.selectric.js index 1573685..1fbc710 100644 --- a/src/jquery.selectric.js +++ b/src/jquery.selectric.js @@ -709,7 +709,7 @@ _this.highlight(goToItem); } - // Tab / Enter / ESC + // Enter / ESC if ( isSelectKey && _this.state.opened ) { _this.select(idx); @@ -1093,7 +1093,7 @@ keys : { previous : [37, 38], // Left / Up next : [39, 40], // Right / Down - select : [9, 13, 27], // Tab / Enter / Escape + select : [13, 27], // Enter / Escape open : [13, 32, 37, 38, 39, 40], // Enter / Space / Left / Up / Right / Down close : [9, 27] // Tab / Escape },