mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
servoshell: Make list of options in <select> prompt scrollable (#36677)
This ensures that the select element is usable when there are a lot of options. Testing: We don't have tests for servoshell. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
632971af26
commit
9dc56d420f
1 changed files with 21 additions and 19 deletions
|
@ -449,32 +449,34 @@ impl Dialog {
|
|||
|
||||
let modal = Modal::new("select_element_picker".into()).area(area);
|
||||
modal.show(ctx, |ui| {
|
||||
for option_or_optgroup in prompt.options() {
|
||||
match &option_or_optgroup {
|
||||
SelectElementOptionOrOptgroup::Option(option) => {
|
||||
display_option(
|
||||
ui,
|
||||
option,
|
||||
&mut selected_option,
|
||||
&mut is_open,
|
||||
false,
|
||||
);
|
||||
},
|
||||
SelectElementOptionOrOptgroup::Optgroup { label, options } => {
|
||||
ui.label(egui::RichText::new(label).strong());
|
||||
|
||||
for option in options {
|
||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
for option_or_optgroup in prompt.options() {
|
||||
match &option_or_optgroup {
|
||||
SelectElementOptionOrOptgroup::Option(option) => {
|
||||
display_option(
|
||||
ui,
|
||||
option,
|
||||
&mut selected_option,
|
||||
&mut is_open,
|
||||
true,
|
||||
false,
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
SelectElementOptionOrOptgroup::Optgroup { label, options } => {
|
||||
ui.label(egui::RichText::new(label).strong());
|
||||
|
||||
for option in options {
|
||||
display_option(
|
||||
ui,
|
||||
option,
|
||||
&mut selected_option,
|
||||
&mut is_open,
|
||||
true,
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
prompt.select(selected_option);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue