tom-select icon indicating copy to clipboard operation
tom-select copied to clipboard

[Bug]: Issue in Bootstrap5 Modal

Open Huangzc88 opened this issue 1 year ago • 2 comments

Bug description

When using tom-select in bootstrap5 modal, the drop-down box data will be blocked when selecting it. Setting z-index cannot solve the problem.

image

image

Can you help fix this problem?

Expected behavior

The expected behavior should be no problem.

Steps to reproduce

used in bootstrap5 modal

Additional context

Bootstrap ver.5.3.1 Microsoft Edge ver.120.0.2210.6 tom-select ver.2.3.0

Huangzc88 avatar Dec 29 '23 13:12 Huangzc88

you may add something like this to break out of the scrollable bs5 modal:

        document.querySelectorAll('[data-bs-toggle="dropdown"]').forEach( (dropdownToggleEl) => {
            bootstrap.Dropdown.getOrCreateInstance(dropdownToggleEl, { popperConfig() { return { strategy: 'fixed' } } });
        });

at least it worked for me.

and you need to add popper to be used by TomSelect

                new TomSelect(e, {
                    onInitialize:function(){
                        this.popper = Popper.createPopper(this.control,this.dropdown);
                    },
                    onDropdownOpen:function(){
                        this.popper.update();
                    },

THenkeDE avatar Feb 01 '24 15:02 THenkeDE

you may add something like this to break out of the scrollable bs5 modal:

        document.querySelectorAll('[data-bs-toggle="dropdown"]').forEach( (dropdownToggleEl) => {
            bootstrap.Dropdown.getOrCreateInstance(dropdownToggleEl, { popperConfig() { return { strategy: 'fixed' } } });
        });

at least it worked for me.

and you need to add popper to be used by TomSelect

                new TomSelect(e, {
                    onInitialize:function(){
                        this.popper = Popper.createPopper(this.control,this.dropdown);
                    },
                    onDropdownOpen:function(){
                        this.popper.update();
                    },

Thank you very much for your answer, I'll see if it works.

Huangzc88 avatar Feb 02 '24 01:02 Huangzc88

This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Jun 01 '24 02:06 github-actions[bot]