-
Notifications
You must be signed in to change notification settings - Fork 152
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
Open direction - UP #52
Comments
I'm encountering a similar need. I was looking around at other examples of how to deal with dropdown/up and found this example using popper. Would be nice to have some sort of auto-positioning, but not sure how difficult that would be. |
Added in |
Hello! Thanks for this amazing project. Are there any plans to have this auto-positioning feature? |
I would like to use this library with popper, as I am currently dealing with an overflow problem that is easily solved with popper. Is there any way to do it @adamberecz? |
@adamberecz excellent feature , really looks and behaves great but I also have the same question if you have any news on the dropdown auto positioning ? |
@adamberecz nice to have openDirection, but I would be glad to see auto-position feature as well! Is it at least planned or under construction? Regards |
@adamberecz I'd like to inform that we still need auto positioning option! |
You can resolve this issue using Calculate the difference between multiselect element top offset and the parent element top offset. Then change the <template>
<div ref="element">
<Multiselect :open-direction="openDirection" @open="onOpen" />
</div>
</template>
<script setup lang="ts">
const element = ref<HTMLElement | null>();
const openDirection = ref<'bottom' | 'top'>('bottom');
const onOpen = () => {
if (!element.value || !element.value.offsetParent) {
return;
}
const parentHeight = element.value.offsetParent.clientHeight;
const position = element.value.offsetTop;
const difference = parentHeight - position;
if (difference < 200) { // <-- Change value as needed
openDirection.value = 'top';
}
};
</script> Few notes:
|
Hi, many thanks for implementing html5 required feature. I think your project is going to be very popular because everybody who uses
vue-multiselect
and plans to migrate to vue3 looks for alternatives and your project stands out from the rest.I'm writing for another feature request. Currently if multiselect is near the bottom of modal , or near the bottom of page it opens to bottom and user has to scroll down to see available options. This is very unpleasant experience, especially if user uses mobile phone. Is there any way to get open direction to
top
?The text was updated successfully, but these errors were encountered: