From 9d4ddaa192b0759045b7c7f00d483b7dd93d204a Mon Sep 17 00:00:00 2001 From: JL102 Date: Mon, 30 Oct 2023 13:49:18 -0400 Subject: [PATCH] docs: added note on how to avoid the incorrectly floating label in a select with empty value Signed-off-by: JL102 --- .../site/src/routes/demo/select/+page.svelte | 21 +++++++++- .../routes/demo/select/_DefaultValue.svelte | 39 +++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 packages/site/src/routes/demo/select/_DefaultValue.svelte diff --git a/packages/site/src/routes/demo/select/+page.svelte b/packages/site/src/routes/demo/select/+page.svelte index 18c6cfeda..6a418a854 100644 --- a/packages/site/src/routes/demo/select/+page.svelte +++ b/packages/site/src/routes/demo/select/+page.svelte @@ -16,8 +16,12 @@ Using Keys - If your options aren't strings, you must provide a key function - that converts them to unique strings, or the label may misbehave. + If your options aren't strings, you must provide a key + function that converts them to unique strings, or the label may misbehave. +
+ The only exception to this is if the text is non-empty while the value is empty. + In this case, due to a limitation in @material/select, the + label will float over the selected text.
@@ -53,6 +57,18 @@ Conditional icon + + + Default Values + + Due to a limitation of @material/select, the floating label + will display incorrectly if the selected option has value="" + but its label is non-empty. +
+ In the case where you need a default value, set it to a non-empty string like + in the second example below. +
+