Fix select multiple default value (#3953)

* Fix select multiple default value

* Add a playwright test for select multiple
This commit is contained in:
Evan Almloff authored and GitHub committed 2025-04-07 17:28:26 -07:00
1 parent cbb91d694f
commit 5e9a505465
6 files changed
+73 -13

No files matched your search

+24
View File
@@ -63,6 +63,7 @@ fn app() -> Element {
OnMounted {}
WebSysClosure {}
DocumentElements {}
SelectMultiple {}
}
}
@@ -155,6 +156,29 @@ fn DocumentElements() -> Element {
}
}
// Select elements have odd default behavior when you set the multiple attribute after mounting the element
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3185
#[component]
fn SelectMultiple() -> Element {
rsx! {
select {
id: "static-multiple-select",
// This is static and will be set in the template
multiple: "true",
option { label: "Value1", value: "1" }
option { label: "Value2", value: "2" }
}
select {
id: "dynamic-multiple-select",
// This is dynamic and will be set after it is mounted
multiple: true,
option { label: "Value1", value: "1" }
option { label: "Value2", value: "2" }
}
}
}
fn main() {
tracing_wasm::set_as_global_default_with_config(
tracing_wasm::WASMLayerConfigBuilder::default()