Choices dropdown appears outside the viewport
See original GitHub issueHi there!
I’m using Choices.js 7.0.0 in my project and there seems to be an issue with the dropdown positioning. Whenever the browser viewport’s height is low, I’d expect the dropdown to appear with the “top” position but it just opens to the bottom, as always, and gets hidden behind the browser viewport:
I use a very basic configuration:
searchEnabled: false, shouldSort: false, itemSelectText: '',
And that’s it. I’ve also removed my custom styling for choices.js for a moment but did not help.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Choices dropdown appears outside the viewport #752 - GitHub
Hi there! I'm using Choices.js 7.0.0 in my project and there seems to be an issue with the dropdown positioning.
Read more >Select Dropdown going out of screen in mobile view
When you view the browser's moblie mode, there is a mechanism that clearly shows your selection and drop-down menu. These sections look ...
Read more >Dropdowns - Bootstrap
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown ...
Read more >Make dropdown show up properly outside of .container ...
Set container's <code>overflow</code> to <code>visible</code>. The problem is that it breaks the scroll bar. 5. </p>. 6. <div class="container">.
Read more >Solution For Very Long Dropdown Menus - CSS-Tricks
The problem with long dropdowns is that the dropdown itself can go below the “fold” of the website. That is, below the visible...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It certainly doesn’t. But in this viewport size, the whole dropdown doesn’t fit neither top nor bottom part. So, we either need to implement some heuristic behavior to have a preference or leave it as is. What will be your suggestion? To calculate in which position the dropdown will have a higher visibility percentage? For small viewports (i.e. mobile) native browsers implements over-viewport UX we have no way to implement in a custom control.
I strongly believe that the case I uploaded the screenshot of is really “ugly”. We can clearly see there is more space to the bottom of the input and that’s where the dropdown should go so the “calculate in which position the dropdown will have a higher visibility percentage” is a great idea.
Another improvement is a new option that could be used to set a certain amount of “space” for the dropdown (either a fixed amount like 200px or a percentage of the dropdown height) and once there is less than that, the native browser select could be shown instead. It would be optional, of course.