slim-select 3.6.0 → 3.6.1

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.
@@ -817,6 +817,7 @@ var o = class {
817
817
  preventNativeSelect = null;
818
818
  preventNativeSelectMousedown = null;
819
819
  preventNativeSelectFocus = null;
820
+ restoreAriaHiddenOnBlur = null;
820
821
  constructor(e) {
821
822
  this.select = e, this.valueChange = this.valueChange.bind(this), this.select.addEventListener("change", this.valueChange, { passive: !0 }), this.observer = new MutationObserver(this.observeCall.bind(this)), this.changeListen(!0);
822
823
  }
@@ -827,12 +828,14 @@ var o = class {
827
828
  this.select.disabled = !0;
828
829
  }
829
830
  hideUI() {
830
- this.select.tabIndex = -1, this.select.style.position = "absolute", this.select.style.width = "1px", this.select.style.height = "1px", this.select.style.opacity = "0", this.select.style.overflow = "hidden", this.select.style.pointerEvents = "none", this.select.style.margin = "0", this.select.style.padding = "0", this.select.style.borderWidth = "0", this.select.style.clip = "rect(0 0 0 0)", this.select.setAttribute("aria-hidden", "true"), this.preventNativeSelect || (this.preventNativeSelect = (e) => {
831
+ this.select.tabIndex = -1, this.select.style.position = "absolute", this.select.style.width = "1px", this.select.style.height = "1px", this.select.style.opacity = "0", this.select.style.overflow = "hidden", this.select.style.pointerEvents = "none", this.select.style.margin = "0", this.select.style.padding = "0", this.select.style.borderWidth = "0", this.select.style.clipPath = "inset(50%)", document.activeElement !== this.select && this.select.setAttribute("aria-hidden", "true"), this.preventNativeSelect || (this.preventNativeSelect = (e) => {
831
832
  e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
832
833
  }, this.preventNativeSelectMousedown = (e) => {
833
834
  e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
834
835
  }, this.preventNativeSelectFocus = (e) => {
835
- e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
836
+ this.select.removeAttribute("aria-hidden"), e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
837
+ }, this.restoreAriaHiddenOnBlur = () => {
838
+ this.select.setAttribute("aria-hidden", "true");
836
839
  }, this.select.addEventListener("click", this.preventNativeSelect, {
837
840
  capture: !0,
838
841
  passive: !1
@@ -842,10 +845,13 @@ var o = class {
842
845
  }), this.select.addEventListener("focus", this.preventNativeSelectFocus, {
843
846
  capture: !0,
844
847
  passive: !1
848
+ }), this.select.addEventListener("blur", this.restoreAriaHiddenOnBlur, {
849
+ capture: !0,
850
+ passive: !0
845
851
  }));
846
852
  }
847
853
  showUI() {
848
- this.select.removeAttribute("tabindex"), this.select.style.position = "", this.select.style.width = "", this.select.style.height = "", this.select.style.opacity = "", this.select.style.overflow = "", this.select.style.pointerEvents = "", this.select.style.margin = "", this.select.style.padding = "", this.select.style.borderWidth = "", this.select.style.clip = "", this.select.removeAttribute("aria-hidden"), this.preventNativeSelect &&= (this.select.removeEventListener("click", this.preventNativeSelect, { capture: !0 }), null), this.preventNativeSelectMousedown &&= (this.select.removeEventListener("mousedown", this.preventNativeSelectMousedown, { capture: !0 }), null), this.preventNativeSelectFocus &&= (this.select.removeEventListener("focus", this.preventNativeSelectFocus, { capture: !0 }), null);
854
+ this.select.removeAttribute("tabindex"), this.select.style.position = "", this.select.style.width = "", this.select.style.height = "", this.select.style.opacity = "", this.select.style.overflow = "", this.select.style.pointerEvents = "", this.select.style.margin = "", this.select.style.padding = "", this.select.style.borderWidth = "", this.select.style.clipPath = "", this.select.removeAttribute("aria-hidden"), this.preventNativeSelect &&= (this.select.removeEventListener("click", this.preventNativeSelect, { capture: !0 }), null), this.preventNativeSelectMousedown &&= (this.select.removeEventListener("mousedown", this.preventNativeSelectMousedown, { capture: !0 }), null), this.preventNativeSelectFocus &&= (this.select.removeEventListener("focus", this.preventNativeSelectFocus, { capture: !0 }), null), this.restoreAriaHiddenOnBlur &&= (this.select.removeEventListener("blur", this.restoreAriaHiddenOnBlur, { capture: !0 }), null);
849
855
  }
850
856
  changeListen(e) {
851
857
  this.listen = e, e && this.observer && this.observer.observe(this.select, {
@@ -1041,7 +1047,7 @@ var o = class {
1041
1047
  });
1042
1048
  }
1043
1049
  destroy() {
1044
- this.changeListen(!1), this.select.removeEventListener("change", this.valueChange), this.preventNativeSelect &&= (this.select.removeEventListener("click", this.preventNativeSelect, { capture: !0 }), null), this.preventNativeSelectMousedown &&= (this.select.removeEventListener("mousedown", this.preventNativeSelectMousedown, { capture: !0 }), null), this.preventNativeSelectFocus &&= (this.select.removeEventListener("focus", this.preventNativeSelectFocus, { capture: !0 }), null), this.observer &&= (this.observer.disconnect(), null), this.removeLabelHandlers(), delete this.select.dataset.id, this.showUI();
1050
+ this.changeListen(!1), this.select.removeEventListener("change", this.valueChange), this.preventNativeSelect &&= (this.select.removeEventListener("click", this.preventNativeSelect, { capture: !0 }), null), this.preventNativeSelectMousedown &&= (this.select.removeEventListener("mousedown", this.preventNativeSelectMousedown, { capture: !0 }), null), this.preventNativeSelectFocus &&= (this.select.removeEventListener("focus", this.preventNativeSelectFocus, { capture: !0 }), null), this.restoreAriaHiddenOnBlur &&= (this.select.removeEventListener("blur", this.restoreAriaHiddenOnBlur, { capture: !0 }), null), this.observer &&= (this.observer.disconnect(), null), this.removeLabelHandlers(), delete this.select.dataset.id, this.showUI();
1045
1051
  }
1046
1052
  }, d = class {
1047
1053
  id = "";