canonical / canonical/vanilla-framework
Add support for scrollable dropdowns
- Dominant language
- HTML
- Stars
- 983
- Forks
- 216
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 3
Description
## Pattern to amend
- Contextual menu
- Search and filter
- Any other dropdowns
## Visual

## Context
Dropdowns that don't fit on the screen can break the layout (this is especially an issue for the application layout in combination with React portals). This can be fixed by adjusting the dropdown to scroll instead of overflowing the screen, however this is a fix that requires JavaScript to implement.
To support this a max-height is calculated and also a min-height is applied as well as `overflow: auto`.
The implementation for the search and filter and contextual menu dropdowns can be seen here:
- https://github.com/canonical/react-components/pull/906
- https://github.com/canonical/react-components/pull/961
From this comment: https://github.com/canonical/react-components/pull/961#issuecomment-1697397844 it would be good to provide some level of support for this in Vanilla so that it doesn't get broken if these components are updated.
Contributor guide
Research direction
Start by reviewing the Contextual menu, Search and filter, and other dropdown patterns, then compare the implementations described in pull requests 906 and 961. Done means Vanilla provides scrollable dropdown support that prevents oversized menus from overflowing the screen without breaking existing patterns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript, sass
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100