@danielgindi/selectbox 1.0.127 → 1.0.129

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.127
2
+ * @danielgindi/selectbox 1.0.129
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -3465,9 +3465,9 @@ class DropList {
3465
3465
 
3466
3466
  // If it's not in the direction that the user expected, invert it
3467
3467
  let invertYPos =
3468
- position.specY === 'top' && newDirection === 'above' ||
3469
- position.specY === 'bottom' && newDirection === 'below' ||
3470
- position.specY !== 'bottom' && position.specY !== 'top' && newDirection === 'above';
3468
+ position.ySpec === 'top' && newDirection === 'above' ||
3469
+ position.ySpec === 'bottom' && newDirection === 'below' ||
3470
+ position.ySpec !== 'bottom' && position.ySpec !== 'top' && newDirection === 'above';
3471
3471
 
3472
3472
  let scrollLeft =
3473
3473
  w.pageXOffset !== undefined ?
@@ -3511,10 +3511,10 @@ class DropList {
3511
3511
  }
3512
3512
 
3513
3513
  if (p.autoFlipDirection) {
3514
- if (position.specX === 'right' &&
3514
+ if (position.xSpec === 'right' &&
3515
3515
  viewCss.left < minX &&
3516
3516
  (Math.max(viewCss.left, minX) + viewSize.width - targetBox.left) / targetBox.width > 0.5 ||
3517
- position.specX === 'left' &&
3517
+ position.xSpec === 'left' &&
3518
3518
  viewCss.left > maxX &&
3519
3519
  (Math.min(viewCss.left, maxX) - targetBox.left) / targetBox.width < 0.5) {
3520
3520
  viewCss.left -= anchor.left - position.left;
@@ -3899,6 +3899,9 @@ class DropList {
3899
3899
  }).
3900
3900
  on('subitems:select', (event) => {
3901
3901
  this._trigger('subitems:select', event);
3902
+ }).
3903
+ on('_back_key_pressed', () => {
3904
+ this._hideSublist();
3902
3905
  });
3903
3906
 
3904
3907
  droplist.setItems(item._subitems);
@@ -3923,6 +3926,8 @@ class DropList {
3923
3926
  itemElement: itemElement,
3924
3927
  droplist: droplist
3925
3928
  };
3929
+
3930
+ droplist.el.focus();
3926
3931
  }
3927
3932
 
3928
3933
  _hideSublist() {
@@ -4320,6 +4325,8 @@ class DropList {
4320
4325
  if (p.currentSubDropList) {
4321
4326
  this._hideSublist();
4322
4327
  preventDefault = false;
4328
+ } else {
4329
+ this._trigger('_back_key_pressed');
4323
4330
  }
4324
4331
  }
4325
4332
  break;