Skip to content

Commit 186b9e8

Browse files
committed
chore: refactor code a bit
1 parent 7eed2f2 commit 186b9e8

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

packages/multiple-select-vanilla/src/MultipleSelectInstance.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,25 +1460,23 @@ export class MultipleSelectInstance {
14601460
}
14611461

14621462
close(reason?: CloseReason) {
1463-
if (this.options.onBeforeClose(reason) === false) {
1464-
return;
1465-
}
1466-
1467-
this._isOpen = false;
1468-
this.options.isOpen = false;
1469-
this.parentElm.classList.remove('ms-parent-open');
1470-
this.choiceElm?.querySelector('div.ms-icon-caret')?.classList.remove('open');
1471-
if (this.dropElm) {
1472-
this.dropElm.style.display = 'none';
1473-
this.dropElm.ariaExpanded = 'false';
1463+
if (this.options.onBeforeClose(reason) !== false) {
1464+
this._isOpen = false;
1465+
this.options.isOpen = false;
1466+
this.parentElm.classList.remove('ms-parent-open');
1467+
this.choiceElm?.querySelector('div.ms-icon-caret')?.classList.remove('open');
1468+
if (this.dropElm) {
1469+
this.dropElm.style.display = 'none';
1470+
this.dropElm.ariaExpanded = 'false';
14741471

1475-
if (this.options.container) {
1476-
this.parentElm.appendChild(this.dropElm);
1477-
this.dropElm.style.top = 'auto';
1478-
this.dropElm.style.left = 'auto';
1472+
if (this.options.container) {
1473+
this.parentElm.appendChild(this.dropElm);
1474+
this.dropElm.style.top = 'auto';
1475+
this.dropElm.style.left = 'auto';
1476+
}
14791477
}
1478+
this.options.onClose(reason);
14801479
}
1481-
this.options.onClose(reason);
14821480
}
14831481

14841482
/**

0 commit comments

Comments
 (0)