Skip to content

Commit 0002b1c

Browse files
committed
refactor(MultiSelect): improve container option handling
1 parent d11b0e1 commit 0002b1c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

js/src/multi-select.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ class MultiSelect extends BaseComponent {
635635

636636
const { container } = this._config
637637
if (container) {
638-
getElement(container).append(dropdownDiv)
638+
container.append(dropdownDiv)
639639
} else {
640640
this._clone.append(dropdownDiv)
641641
}
@@ -994,6 +994,18 @@ class MultiSelect extends BaseComponent {
994994
getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()
995995
}
996996

997+
_configAfterMerge(config) {
998+
if (config.container === true) {
999+
config.container = document.body
1000+
}
1001+
1002+
if (typeof config.container === 'object' || typeof config.container === 'string') {
1003+
config.container = getElement(config.container)
1004+
}
1005+
1006+
return config
1007+
}
1008+
9971009
// Static
9981010

9991011
static multiSelectInterface(element, config) {

0 commit comments

Comments
 (0)