Skip to content

Commit d030ecb

Browse files
committed
fix: VirtualScroll and drop auto-width should work without timeout delay
1 parent c89f601 commit d030ecb

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

demo/src/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88

99
.cloak {
10-
display: none;
10+
visibility: 'hidden';
1111
}
1212
h2 .links {
1313
font-size: 18px;

lib/src/MultipleSelectInstance.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,8 @@ export class MultipleSelectInstance {
6565
this.initSelected(true);
6666
this.initFilter();
6767
this.initDrop();
68-
69-
// wait a CPU cycle for the select auto-width to return a width which is over 0
70-
setTimeout(() => {
71-
this.initView();
72-
this.options.onAfterCreate();
73-
});
68+
this.initView();
69+
this.options.onAfterCreate();
7470
}
7571

7672
/**
@@ -793,7 +789,7 @@ export class MultipleSelectInstance {
793789
return;
794790
}
795791
// this.options.isOpen = true;
796-
setTimeout(() => (this.options.isOpen = true)); // TODO: original code doesn't need setTimeout
792+
setTimeout(() => (this.options.isOpen = true)); // TODO: original code doesn't require this delay
797793
this.parentElm.classList.add('ms-parent-open');
798794
this.choiceElm?.querySelector('div')?.classList.add('open');
799795
this.dropElm.style.display = 'block';

0 commit comments

Comments
 (0)