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

[Bug]: Combobox goes outside the view #424

Open
2 tasks
maelp opened this issue Mar 21, 2024 · 8 comments
Open
2 tasks

[Bug]: Combobox goes outside the view #424

maelp opened this issue Mar 21, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@maelp
Copy link

maelp commented Mar 21, 2024

Reproduction

https://stackblitz.com/edit/fls328?file=src%2FApp.vue

Describe the bug

When the combobox is at the bottom of the view (or more commonly: at the bottom of an AlertDialog or whatever) it can often "leave the window", and doesn't seem to use avoid-collisions to show on the right side

image

System Info

System:
    OS: macOS 14.1.2
    CPU: (8) arm64 Apple M1
    Memory: 101.98 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.16.0 - ~/.node/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.15.4 - ~/Library/pnpm/pnpm
    Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 123.0.6312.58
    Safari: 17.1.2
  npmPackages:
    @vueuse/core: 10.8.0 => 10.8.0 
    radix-vue: 1.5.3 => 1.5.3 
    vue: 3.4.19 => 3.4.19

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@maelp maelp added the bug Something isn't working label Mar 21, 2024
@romanhrynevych
Copy link
Collaborator

@maelp Thank for your reproduction 👍

Based on radix-vue docs you can limit available height to define scroll, but this is not the approach you are chasing.

I made a small fix on your repo where just added min-h-[100px] to PopoverContent component. reproduction. This forces Radix-vue to recalculate position and place Content above our trigger.

@sadeghbarati Hello mate, I don't think this issue is valid to shadcn-vue repo, maybe need to update radix-vue docs, what do you think?

image

@sadeghbarati
Copy link
Collaborator

@romanhrynevych Hello Roman, sure, go ahead

I'm not familiar with FloatingUI stuff

@maelp
Copy link
Author

maelp commented Apr 15, 2024

@sadeghbarati @romanhrynevych any update on this? is there a way to fix this without having to introduce an arbitrary size limit?

@maelp
Copy link
Author

maelp commented Apr 15, 2024

@romanhrynevych the bug still exists when we add the Combobox in a Dialog, any idea how to fix this?

https://stackblitz.com/edit/fls328-mq6rcb?file=src%2FApp.vue,src%2Fcomponents%2Fui%2Fpopover%2FPopover.vue

@romanhrynevych
Copy link
Collaborator

@maelp Everything works fine for me, can you add some screenshots?

image

@maelp
Copy link
Author

maelp commented Apr 16, 2024

image

If you make the window smaller it doesn't display correctly

@romanhrynevych
Copy link
Collaborator

Based on same logic with min-h, just increase size to 210px taken from screenshot and everything works fine 🙂

image

Reproduction: https://stackblitz.com/edit/fls328-chcabe?file=src%2FApp.vue

@maelp
Copy link
Author

maelp commented Apr 16, 2024

hmmmm weird, I'd rather not use a large min-h, because otherwise if there's only a few options it will be "mostly empty" no? @sadeghbarati

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants