Skip to content

Commit ab4cd2e

Browse files
fix(select): set placeholder option as selected if it doesn't have a value (#4885)
* fix(select): Set placeholder option as selected when no value * auto update snapshots (#4892) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Create cyan-scissors-burn.md * auto update snapshots (#4900) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 51465d6 commit ab4cd2e

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.changeset/cyan-scissors-burn.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@db-ux/core-components": patch
3+
"@db-ux/ngx-core-components": patch
4+
"@db-ux/react-core-components": patch
5+
"@db-ux/v-core-components": patch
6+
"@db-ux/wc-core-components": patch
7+
---
8+
9+
fix(select): set placeholder option as selected if it doesn't contain a value
-19.5 KB
Loading

packages/components/src/components/select/select.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export default function DBSelect(props: DBSelectProps) {
238238
aria-describedby={props.ariaDescribedBy ?? state._descByIds}>
239239
{/* Empty option for floating label */}
240240
<Show when={props.variant === 'floating' || props.placeholder}>
241-
<option class="placeholder" value=""></option>
241+
<option class="placeholder" value="" selected={!props.value}></option>
242242
</Show>
243243
<Show when={props.options?.length} else={props.children}>
244244
<For each={props.options}>

0 commit comments

Comments
 (0)