@cscfi/csc-ui 1.3.0 → 1.3.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.
@@ -658,6 +658,7 @@ const CDropdown = class {
658
658
  this._debounce = null;
659
659
  this._isMobile = false;
660
660
  this._listItems = [];
661
+ this._isOpening = false;
661
662
  this._inputSize = {
662
663
  height: 0,
663
664
  width: 0,
@@ -681,6 +682,8 @@ const CDropdown = class {
681
682
  });
682
683
  }
683
684
  async stateWatcher(isOpen) {
685
+ if (isOpen)
686
+ this._handleOpen();
684
687
  this.dropdownStateChange.emit(isOpen);
685
688
  this._scrollParent = this._scrollParent || (await getScrollParent.getScrollParent(this.el));
686
689
  this._scrollParent.style.overflow = isOpen ? 'hidden' : null;
@@ -726,6 +729,12 @@ const CDropdown = class {
726
729
  _setIsMobile() {
727
730
  this._isMobile = window.matchMedia('only screen and (max-width: 760px)').matches;
728
731
  }
732
+ _handleOpen() {
733
+ this._isOpening = true;
734
+ setTimeout(() => {
735
+ this._isOpening = false;
736
+ }, 500);
737
+ }
729
738
  componentDidLoad() {
730
739
  this._setIsMobile();
731
740
  this._hideDetails = this.parent.hideDetails;
@@ -734,7 +743,7 @@ const CDropdown = class {
734
743
  if (!this._dialog.open)
735
744
  return;
736
745
  requestAnimationFrame(() => {
737
- if (!Array.isArray(entries) || !entries.length)
746
+ if (!Array.isArray(entries) || !entries.length || this._isOpening)
738
747
  return;
739
748
  this._setIsMobile();
740
749
  this.close();