Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with :append-to-body="true" in a modal. #416

Open
iford opened this issue Jun 21, 2024 · 3 comments
Open

issue with :append-to-body="true" in a modal. #416

iford opened this issue Jun 21, 2024 · 3 comments

Comments

@iford
Copy link

iford commented Jun 21, 2024

I am using version 2.6.8 and I encountered an issue with :append-to-body="true" in a modal. I cannot select the dropdown.

Version

  • Vue version: 3

Description

<div id="modal-surface-create" ref="modal" class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false">
	<div class="modal-dialog modal-lg modal-dialog-centered">
		<div class="modal-content">
			<div class="modal-header border-0">
				<h3 class="modal-title fw-semibold">แก้ไขข้อมูล</h3>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
			</div>
			<div class="col-12 col-md-4 col-lg-4 mb-5">
				<VueMultiselect
					v-model="t"
					:options="toOptions(generateOptionTable())"
					:append-to-body="true"
					@input="
						(e:any) => {
							console.log(e)
						}
					"
				>
				</VueMultiselect>
			</div>

		</div>
	</div>
@mikehodgson
Copy link

Can confirm, we are running into the same issue when using it in a UIKit modal.

@JasperTey
Copy link

If by "cannot select the dropdown" you mean that the dropdown overlay does not appear while inside a modal, it might be that your modal's z-index is higher than the dropdown overlay, causing it to appear "behind the modal" and out of sight.

First find out what your application's .modal z-index is. Then ensure you specify the same or higher z-index for the multiselect component's "dropdown" class.

I think you're using Bootstrap judging by your snippet, in which case their modals use z-index of 1055 by default.

So maybe something like this:

.modal-dialog .multiselect-dropdown {
    z-index: 1060 !important;
}

Or if using tailwind, handle it through the :classes prop:

<MultiSelect :classes="{ dropdown: 'multiselect-dropdown !z-[1060]' }" ... > 

Hope this helps someone - I was experiencing this issue and resolved it as such.

@mikehodgson
Copy link

@JasperTey That's not what's being described here. The issue is that the drop-down appears, but nothing can be selected. I have attached a demo of the problem. If you use the keyboard, you CAN select something.

cant-select-dropdown.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants