@danielgindi/selectbox 1.0.79 → 1.0.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 1.0.79
2
+ * @danielgindi/selectbox 1.0.80
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -7790,7 +7790,6 @@ var DropList = /*#__PURE__*/function () {
7790
7790
  var p = this._p;
7791
7791
 
7792
7792
  p.sink.add(p.el, 'keydown', function (evt) {return _this9._keydown(evt);});
7793
- p.sink.add(p.el, 'keypress', function (evt) {return _this9._keydown(evt);});
7794
7793
  } }, { key: "_keydown", value:
7795
7794
 
7796
7795
  function _keydown(event) {
@@ -11393,9 +11392,7 @@ var SelectBox = /*#__PURE__*/function () {
11393
11392
  if (!dropList) return;
11394
11393
 
11395
11394
  var avoidToggleFromClick = false,
11396
- currentTouchId = null,
11397
- suppressKeyPress = false,
11398
- suppressKeyPressRepeat = false;
11395
+ currentTouchId = null;
11399
11396
 
11400
11397
  var keyEventsTarget = p.multi || p.searchable ? p.input : p.el;
11401
11398
 
@@ -11404,8 +11401,7 @@ var SelectBox = /*#__PURE__*/function () {
11404
11401
  if ( /**@type HTMLInputElement*/evt.currentTarget.readOnly)
11405
11402
  return;
11406
11403
 
11407
- suppressKeyPress = false;
11408
- suppressKeyPressRepeat = false;
11404
+ var suppressEnterSpaceToggle = false;
11409
11405
 
11410
11406
  switch (evt.key) {
11411
11407
  case keycodeJs.VALUE_PAGE_UP:
@@ -11417,12 +11413,10 @@ var SelectBox = /*#__PURE__*/function () {
11417
11413
  if ((evt.key === keycodeJs.VALUE_HOME || evt.key === keycodeJs.VALUE_END) &&
11418
11414
  p.input && p.input.value.length > 0 && !p.lastKeyAllowsNonTypeKeys) {
11419
11415
  // Allow using HOME/END button within the textbox
11420
- suppressKeyPressRepeat = true;
11421
11416
  dropList._keydownFreeType(evt);
11422
11417
  break;
11423
11418
  }
11424
11419
 
11425
- suppressKeyPress = true;
11426
11420
  evt.preventDefault();
11427
11421
 
11428
11422
  switch (evt.key) {
@@ -11462,8 +11456,7 @@ var SelectBox = /*#__PURE__*/function () {
11462
11456
  case keycodeJs.VALUE_SPACE:
11463
11457
  if (p.lastKeyAllowsNonTypeKeys) {
11464
11458
  if (dropList.isVisible() && dropList.hasFocusedItem()) {
11465
- suppressKeyPress = true;
11466
- suppressKeyPressRepeat = true;
11459
+ suppressEnterSpaceToggle = true;
11467
11460
  if (p.multi)
11468
11461
  dropList.toggleFocusedItem(evt);else
11469
11462
  dropList.triggerItemSelection(evt);
@@ -11474,8 +11467,7 @@ var SelectBox = /*#__PURE__*/function () {
11474
11467
 
11475
11468
  case keycodeJs.VALUE_ENTER:
11476
11469
  if (dropList.isVisible() && dropList.hasFocusedItem()) {
11477
- suppressKeyPress = true;
11478
- suppressKeyPressRepeat = true;
11470
+ suppressEnterSpaceToggle = true;
11479
11471
  evt.preventDefault();
11480
11472
  dropList.triggerItemSelection(evt);
11481
11473
  }
@@ -11496,7 +11488,6 @@ var SelectBox = /*#__PURE__*/function () {
11496
11488
  break;
11497
11489
 
11498
11490
  default:
11499
- suppressKeyPressRepeat = true;
11500
11491
  dropList._keydownFreeType(evt);
11501
11492
  break;}
11502
11493
 
@@ -11508,27 +11499,18 @@ var SelectBox = /*#__PURE__*/function () {
11508
11499
  evt.key === keycodeJs.VALUE_HOME ||
11509
11500
  evt.key === keycodeJs.VALUE_END ||
11510
11501
  evt.key === keycodeJs.VALUE_SPACE && !!p.lastKeyAllowsNonTypeKeys;
11511
- }).
11512
- add(keyEventsTarget, 'keypress.dropdown', function (evt) {
11513
- if (suppressKeyPress) {
11514
- suppressKeyPress = false;
11515
- evt.preventDefault();
11516
- return;
11517
- }
11518
-
11519
- if (suppressKeyPressRepeat)
11520
- return;
11521
-
11522
- if (evt.key === keycodeJs.VALUE_ENTER ||
11523
- evt.key === keycodeJs.VALUE_SPACE &&
11524
- p.lastKeyAllowsNonTypeKeys &&
11525
- !p.multi &&
11526
- !dropList.hasFocusedItem())
11527
11502
 
11528
- {
11529
- _this6.toggleList();
11530
- evt.preventDefault();
11531
- evt.stopPropagation();
11503
+ if (!suppressEnterSpaceToggle) {
11504
+ if (evt.key === keycodeJs.VALUE_ENTER ||
11505
+ evt.key === keycodeJs.VALUE_SPACE &&
11506
+ p.lastKeyAllowsNonTypeKeys &&
11507
+ !p.multi &&
11508
+ !dropList.hasFocusedItem())
11509
+ {
11510
+ _this6.toggleList();
11511
+ evt.preventDefault();
11512
+ evt.stopPropagation();
11513
+ }
11532
11514
  }
11533
11515
  });
11534
11516