Skip to content

refactor(selector): not hiding the first option anymore #4020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/components/src/components/select/select.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ export default function DBSelect(props: DBSelectProps) {
}
aria-describedby={state._descByIds}>
{/* Empty option for floating label */}
<option hidden></option>
<Show when={props.variant === 'floating' || props.placeholder}>
<option class="placeholder"></option>
</Show>
<Show when={props.options}>
<For each={props.options}>
{(option: DBSelectOptionType) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $has-before-padding: calc(
);
}

&:has(> select option:checked:not([hidden])) {
&:has(> select option:checked:not(.placeholder)) {
[id$="-placeholder"] {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ $check-border-size: min(#{variables.$db-border-height-2xs}, 2px);
&:has(
#{$selector}:focus-within,
#{$selector}:is(input, textarea):not(:placeholder-shown),
> select option:checked:not([hidden])
> select option:checked:not(.placeholder)
) {
label {
@extend %db-overwrite-font-size-2xs;
Expand Down
Loading