setting: Make dropdown popup scrollable by default with fluent override#2293
Merged
madcodelife merged 1 commit intolongbridge:mainfrom Apr 27, 2026
Merged
Conversation
madcodelife
reviewed
Apr 27, 2026
| /// the viewport, default is `true`. | ||
| /// | ||
| /// Has no effect on non-dropdown field types. | ||
| pub fn scrollable(mut self, scrollable: bool) -> Self { |
Member
There was a problem hiding this comment.
Thanks for addressing the overflow issue.
The scrollable(bool) method is somewhat opaque — it would be better to just add a dedicated scrollable_dropdown() method to distinguish it from the existing dropdown().
SettingField::dropdown(items, getter, setter) // unchanged, no scroll
SettingField::scrollable_dropdown(items, getter, setter) // opt-in scroll`SettingField::dropdown` builds its popup via `PopupMenu` but never opts into `PopupMenu::scrollable`. With long option lists the menu overflows the viewport and entries below the fold are unreachable. Add a sibling constructor: ```rust SettingField::dropdown(items, getter, setter) // unchanged SettingField::scrollable_dropdown(items, getter, setter) // opt-in scroll ``` `SettingFieldType::Dropdown` gains a `scrollable: bool` field that the two constructors set explicitly. Callers pick the variant at the call site rather than via a fluent setter — which matches the suggestion on the review. `dropdown(...)` keeps `scrollable = false`, so existing call sites are byte-identical. The new `scrollable_dropdown(...)` is purely additive. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Rewrote per the suggestion — replaced the fluent SettingField::dropdown(items, ...) // unchanged, no scroll
SettingField::scrollable_dropdown(items, ...) // opt-in scroll
|
65ee4df to
8dec6dd
Compare
Member
|
Thank you! |
boboshan
added a commit
to boboshan/gpui-component
that referenced
this pull request
Apr 27, 2026
…de (longbridge#2293) ## Summary `SettingField`'s dropdown variant builds its popup via `PopupMenu` but never opts into `PopupMenu::scrollable`. With long option lists the menu overflows the viewport and entries below the fold are unreachable. This PR: - Defaults `scrollable: true` so out-of-the-box dropdowns degrade gracefully on long menus. - Adds a fluent `.scrollable(bool)` setter on `SettingField<SharedString>` for callers who want to opt out, mirroring the builder style of `GroupBoxVariants::with_variant` and `Sizable::small`/`medium`. ```rust SettingField::dropdown(items, getter, setter) // scrollable SettingField::dropdown(items, getter, setter) .scrollable(false) // no scroll ``` `SettingFieldType::Dropdown` gains a `scrollable: bool` field; the existing `dropdown(...)` constructor sets it to `true`. The setter mutates the variant in place when the field is a dropdown, no-op otherwise. No public API breakage — all existing callers of `SettingField::dropdown(...)` keep working unchanged. ## Test plan - [x] `cargo check --workspace` passes locally. - [x] Long option list (verified in a downstream app): menu scrolls, items below fold reachable. - [x] Short option list still renders without scrollbar chrome. - [ ] `dropdown(...).scrollable(false)` disables scrolling. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
boboshan
added a commit
to boboshan/gpui-component
that referenced
this pull request
Apr 27, 2026
…de (longbridge#2293) ## Summary `SettingField`'s dropdown variant builds its popup via `PopupMenu` but never opts into `PopupMenu::scrollable`. With long option lists the menu overflows the viewport and entries below the fold are unreachable. This PR: - Defaults `scrollable: true` so out-of-the-box dropdowns degrade gracefully on long menus. - Adds a fluent `.scrollable(bool)` setter on `SettingField<SharedString>` for callers who want to opt out, mirroring the builder style of `GroupBoxVariants::with_variant` and `Sizable::small`/`medium`. ```rust SettingField::dropdown(items, getter, setter) // scrollable SettingField::dropdown(items, getter, setter) .scrollable(false) // no scroll ``` `SettingFieldType::Dropdown` gains a `scrollable: bool` field; the existing `dropdown(...)` constructor sets it to `true`. The setter mutates the variant in place when the field is a dropdown, no-op otherwise. No public API breakage — all existing callers of `SettingField::dropdown(...)` keep working unchanged. ## Test plan - [x] `cargo check --workspace` passes locally. - [x] Long option list (verified in a downstream app): menu scrolls, items below fold reachable. - [x] Short option list still renders without scrollbar chrome. - [ ] `dropdown(...).scrollable(false)` disables scrolling. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AzureZee
pushed a commit
to AzureZee/gpui-component
that referenced
this pull request
Apr 29, 2026
…de (longbridge#2293) ## Summary `SettingField`'s dropdown variant builds its popup via `PopupMenu` but never opts into `PopupMenu::scrollable`. With long option lists the menu overflows the viewport and entries below the fold are unreachable. This PR: - Defaults `scrollable: true` so out-of-the-box dropdowns degrade gracefully on long menus. - Adds a fluent `.scrollable(bool)` setter on `SettingField<SharedString>` for callers who want to opt out, mirroring the builder style of `GroupBoxVariants::with_variant` and `Sizable::small`/`medium`. ```rust SettingField::dropdown(items, getter, setter) // scrollable SettingField::dropdown(items, getter, setter) .scrollable(false) // no scroll ``` `SettingFieldType::Dropdown` gains a `scrollable: bool` field; the existing `dropdown(...)` constructor sets it to `true`. The setter mutates the variant in place when the field is a dropdown, no-op otherwise. No public API breakage — all existing callers of `SettingField::dropdown(...)` keep working unchanged. ## Test plan - [x] `cargo check --workspace` passes locally. - [x] Long option list (verified in a downstream app): menu scrolls, items below fold reachable. - [x] Short option list still renders without scrollbar chrome. - [ ] `dropdown(...).scrollable(false)` disables scrolling. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SettingField's dropdown variant builds its popup viaPopupMenubut never opts intoPopupMenu::scrollable. With long option lists the menu overflows the viewport and entries below the fold are unreachable.This PR:
scrollable: trueso out-of-the-box dropdowns degrade gracefully on long menus..scrollable(bool)setter onSettingField<SharedString>for callers who want to opt out, mirroring the builder style ofGroupBoxVariants::with_variantandSizable::small/medium.SettingFieldType::Dropdowngains ascrollable: boolfield; the existingdropdown(...)constructor sets it totrue. The setter mutates the variant in place when the field is a dropdown, no-op otherwise.No public API breakage — all existing callers of
SettingField::dropdown(...)keep working unchanged.Test plan
cargo check --workspacepasses locally.dropdown(...).scrollable(false)disables scrolling.