@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.
@@ -654,6 +654,7 @@ const CDropdown = class {
654
654
  this._debounce = null;
655
655
  this._isMobile = false;
656
656
  this._listItems = [];
657
+ this._isOpening = false;
657
658
  this._inputSize = {
658
659
  height: 0,
659
660
  width: 0,
@@ -677,6 +678,8 @@ const CDropdown = class {
677
678
  });
678
679
  }
679
680
  async stateWatcher(isOpen) {
681
+ if (isOpen)
682
+ this._handleOpen();
680
683
  this.dropdownStateChange.emit(isOpen);
681
684
  this._scrollParent = this._scrollParent || (await getScrollParent(this.el));
682
685
  this._scrollParent.style.overflow = isOpen ? 'hidden' : null;
@@ -722,6 +725,12 @@ const CDropdown = class {
722
725
  _setIsMobile() {
723
726
  this._isMobile = window.matchMedia('only screen and (max-width: 760px)').matches;
724
727
  }
728
+ _handleOpen() {
729
+ this._isOpening = true;
730
+ setTimeout(() => {
731
+ this._isOpening = false;
732
+ }, 500);
733
+ }
725
734
  componentDidLoad() {
726
735
  this._setIsMobile();
727
736
  this._hideDetails = this.parent.hideDetails;
@@ -730,7 +739,7 @@ const CDropdown = class {
730
739
  if (!this._dialog.open)
731
740
  return;
732
741
  requestAnimationFrame(() => {
733
- if (!Array.isArray(entries) || !entries.length)
742
+ if (!Array.isArray(entries) || !entries.length || this._isOpening)
734
743
  return;
735
744
  this._setIsMobile();
736
745
  this.close();