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

How to set chips autocomplete container option #6612

Open
ugoQ opened this issue Oct 30, 2020 · 2 comments
Open

How to set chips autocomplete container option #6612

ugoQ opened this issue Oct 30, 2020 · 2 comments

Comments

@ugoQ
Copy link

ugoQ commented Oct 30, 2020

Hello,
I have a chips input in a modal. I would like to set the container to document.body for the autocomplete dropdown, because it messes with the scroll of my modal.

My chips component looks like this

<div class="chips chips-autocomplete">
    <input class="input-chips-autocomplete"/>
</div>

So, for a "classic" dropdown, I would do something like
$('.dropdown-trigger').dropdown({container: document.body})

But here if I do this $('.input-chips-autocomplete').dropdown({container: document.body}), it completely messes up with the dropdown (I can't properly focus on the input, the dropdown doesn't always appears)...

Any help would be gladly appreciated...

@ryanrapini
Copy link

dug into code for this, and can't find a way to make this work as you like, my solution was to make sure the modal had overflow:visible on both the modal div and the modal-content div.

@ugoQ
Copy link
Author

ugoQ commented Apr 13, 2021

@ryanrapini Thank you. I still need my modal-content to be scrollable though, so this workaround doesn't help me unfortunately.
I have a workaround where I move myself the dropdown before the modal DOM, I have used it for ages now...
Like so $('.my-autocomplete-dropdown').insertBefore($('#my-modal'));
So this avoids messing with my modal scroll and the dropdown appears "above" my modal, that's a first step.

But there is a drawback, my "manual" method impacts the dropdown height and it seems to occur only when I type more than one character in a row... Like if I type "e", the height is right (say around 300px), but if I type "ee", the height is only around 90px, so it displays only the first result and half of the second...

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

2 participants