Skip to content
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

SelectList: fix placeholder color #3813

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions packages/gestalt/src/SelectList.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
padding: 0 35px 0 16px; /* right padding prevents it from running into arrow */
}

.placeholder {
color: var(--color-text-formfield-placeholder);
}

.selected {
color: var(--color-text-formfield-default);
}

.enabled {
background-color: var(--color-transparent);
}

.select::-ms-expand {
display: none;
}
4 changes: 3 additions & 1 deletion packages/gestalt/src/SelectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ function SelectList({
formElement.base,
size === 'md' ? layout.medium : layout.large,
{
[styles.placeholder]: !disabled && placeholder && !value,
[styles.selected]: (!disabled && placeholder && value) || (!disabled && !placeholder),
[styles.enabled]: !disabled,
[formElement.md]: size === 'md',
[formElement.lg]: size === 'lg',
[formElement.normal]: !errorMessage,
[formElement.enabledTransparent]: !disabled,
[formElement.disabled]: disabled,
[formElement.errored]: !disabled && !!errorMessage,
},
Expand Down
4 changes: 4 additions & 0 deletions packages/gestalt/src/SelectList/VRSelectList.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
width: 100%;
}

.placeholderText {
color: var(--sema-color-text-subtle);
}

.enabledText {
color: var(--sema-color-text-default);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/gestalt/src/SelectList/VRSelectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ const SelectListWithForwardRef = forwardRef<HTMLSelectElement, Props>(function I
aria-describedby={focused ? ariaDescribedby : undefined}
aria-invalid={hasErrorMessage ? 'true' : 'false'}
className={classnames(styles.input, typographyStyle.truncate, {
[styles.enabledText]: !disabled,
[styles.placeholderText]: !disabled && placeholder && !value,
[styles.enabledText]:
(!disabled && placeholder && value) || (!disabled && !placeholder),
[styles.enabledBorder]: !disabled && !hasErrorMessage,
[styles.errorBorder]: !disabled && hasErrorMessage,
[styles.disabledText]: disabled,
Expand Down
6 changes: 3 additions & 3 deletions packages/gestalt/src/__snapshots__/SelectList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports[`SelectList renders an option group 1`] = `
</div>
<select
aria-invalid="false"
className="select base medium md normal enabledTransparent"
className="select base medium selected enabled md normal"
disabled={false}
id="optionGroup"
onBlur={[Function]}
Expand Down Expand Up @@ -145,7 +145,7 @@ exports[`SelectList renders with a hidden label 1`] = `
</div>
<select
aria-invalid="false"
className="select base medium md normal enabledTransparent"
className="select base medium selected enabled md normal"
disabled={false}
id="test"
onBlur={[Function]}
Expand Down Expand Up @@ -210,7 +210,7 @@ exports[`SelectList renders with typical props 1`] = `
</div>
<select
aria-invalid="false"
className="select base medium md normal enabledTransparent"
className="select base medium selected enabled md normal"
disabled={false}
id="test"
onBlur={[Function]}
Expand Down
Loading