@danielgindi/selectbox 1.0.128 → 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.es6.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 1.0.128
2
+ * @danielgindi/selectbox 1.0.129
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  import { createElement, closestUntil, setElementAttrs, next, prev } from '@danielgindi/dom-utils/lib/Dom';
@@ -983,9 +983,9 @@ class DropList {
983
983
 
984
984
  // If it's not in the direction that the user expected, invert it
985
985
  let invertYPos =
986
- (position.specY === 'top' && newDirection === 'above') ||
987
- (position.specY === 'bottom' && newDirection === 'below') ||
988
- (position.specY !== 'bottom' && position.specY !== 'top' && newDirection === 'above');
986
+ (position.ySpec === 'top' && newDirection === 'above') ||
987
+ (position.ySpec === 'bottom' && newDirection === 'below') ||
988
+ (position.ySpec !== 'bottom' && position.ySpec !== 'top' && newDirection === 'above');
989
989
 
990
990
  let scrollLeft =
991
991
  (w.pageXOffset !== undefined) ?
@@ -1029,10 +1029,10 @@ class DropList {
1029
1029
  }
1030
1030
 
1031
1031
  if (p.autoFlipDirection) {
1032
- if ((position.specX === 'right' &&
1032
+ if ((position.xSpec === 'right' &&
1033
1033
  viewCss.left < minX &&
1034
1034
  (Math.max(viewCss.left, minX) + viewSize.width - targetBox.left) / targetBox.width > 0.5) ||
1035
- (position.specX === 'left' &&
1035
+ (position.xSpec === 'left' &&
1036
1036
  viewCss.left > maxX &&
1037
1037
  (Math.min(viewCss.left, maxX) - targetBox.left) / targetBox.width < 0.5)) {
1038
1038
  viewCss.left -= anchor.left - position.left;
@@ -1417,6 +1417,9 @@ class DropList {
1417
1417
  })
1418
1418
  .on('subitems:select', event => {
1419
1419
  this._trigger('subitems:select', event);
1420
+ })
1421
+ .on('_back_key_pressed', () => {
1422
+ this._hideSublist();
1420
1423
  });
1421
1424
 
1422
1425
  droplist.setItems(item._subitems);
@@ -1840,6 +1843,8 @@ class DropList {
1840
1843
  if (p.currentSubDropList) {
1841
1844
  this._hideSublist();
1842
1845
  preventDefault = false;
1846
+ } else {
1847
+ this._trigger('_back_key_pressed');
1843
1848
  }
1844
1849
  }
1845
1850
  break;