Skip to content

fix(picker,infieldbutton): updates custom properties for background/border colors #3536

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

Merged
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 .changeset/nervous-penguins-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@spectrum-css/infieldbutton": patch
"@spectrum-css/stepper": patch
"@spectrum-css/picker": patch
---

S2 Foundations fixes

- Adjusts the background-color of the infield button components within stepper to use `gray-100` as opposed to `gray-25`.
- This corresponds to the background-color updates picker has for S2.
- Corrects the border color for the default picker for S2 foundations, using `gray-500` (instead of `gray-800`) to align with other field/form components.
- Refactors the `&.is-keyboardFocused&.is-placeholder` selector to `&.is-keyboardFocused.spectrum-Picker-label.is-placeholder` to avoid unexpectedly targeting the nested placeholder class.
1 change: 0 additions & 1 deletion components/infieldbutton/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"--spectrum-disabled-content-color",
"--spectrum-gray-100",
"--spectrum-gray-200",
"--spectrum-gray-50",
"--spectrum-neutral-content-color-default",
"--spectrum-neutral-content-color-down",
"--spectrum-neutral-content-color-hover",
Expand Down
6 changes: 3 additions & 3 deletions components/infieldbutton/themes/spectrum-two.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
--spectrum-infield-button-stacked-top-border-radius-start-start: var(--spectrum-infield-button-border-radius-reset);
--spectrum-infield-button-stacked-bottom-border-radius-end-start: var(--spectrum-infield-button-border-radius-reset);

--spectrum-infield-button-background-color: var(--spectrum-gray-50);
--spectrum-infield-button-background-color-hover: var(--spectrum-gray-100);
--spectrum-infield-button-background-color: var(--spectrum-gray-100);
--spectrum-infield-button-background-color-hover: var(--spectrum-gray-200);
--spectrum-infield-button-background-color-down: var(--spectrum-gray-200);
--spectrum-infield-button-background-color-key-focus: var(--spectrum-gray-100);
--spectrum-infield-button-background-color-key-focus: var(--spectrum-gray-200);
Comment on lines +26 to +29
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes, along with the stepper changes, are not reflected in Figma yet. They're working on updating them, but decided to have the stepper buttons' background color match the s2 picker background color.

}
}
5 changes: 2 additions & 3 deletions components/picker/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
".spectrum-Picker.is-invalid:not(:disabled, .is-disabled):focus-visible",
".spectrum-Picker.is-invalid:not(:disabled, .is-disabled):hover",
".spectrum-Picker.is-keyboardFocused",
".spectrum-Picker.is-keyboardFocused .spectrum-Picker-label.is-placeholder",
".spectrum-Picker.is-keyboardFocused .spectrum-Picker-menuIcon",
".spectrum-Picker.is-keyboardFocused.is-placeholder",
".spectrum-Picker.is-keyboardFocused:after",
".spectrum-Picker.is-loading .spectrum-Picker-label",
".spectrum-Picker.is-loading .spectrum-Picker-menuIcon",
Expand All @@ -59,7 +59,6 @@
".spectrum-Picker.is-open:not(.spectrum-Picker--quiet, :disabled, .is-disabled):hover",
".spectrum-Picker.is-open:not(.spectrum-Picker--quiet, :disabled, .is-disabled):hover .spectrum-Picker-menuIcon",
".spectrum-Picker.is-placeholder:active .spectrum-Picker-label",
".spectrum-Picker.is-placeholder:focus-visible",
".spectrum-Picker::-moz-focus-inner",
".spectrum-Picker:active",
".spectrum-Picker:active:after",
Expand All @@ -71,6 +70,7 @@
".spectrum-Picker:disabled .spectrum-Picker-validationIcon",
".spectrum-Picker:focus",
".spectrum-Picker:focus-visible",
".spectrum-Picker:focus-visible .spectrum-Picker-label.is-placeholder",
".spectrum-Picker:focus-visible .spectrum-Picker-menuIcon",
".spectrum-Picker:focus-visible:after",
".spectrum-Picker:hover",
Expand Down Expand Up @@ -281,7 +281,6 @@
"--spectrum-gray-500",
"--spectrum-gray-600",
"--spectrum-gray-700",
"--spectrum-gray-800",
"--spectrum-gray-900",
"--spectrum-line-height-100",
"--spectrum-negative-border-color-default",
Expand Down
2 changes: 1 addition & 1 deletion components/picker/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
border-color: var(--highcontrast-picker-focus-indicator-color, var(--mod-picker-focus-indicator-color, var(--spectrum-picker-focus-indicator-color)));
}

&.is-placeholder {
.spectrum-Picker-label.is-placeholder {
color: var(--highcontrast-picker-content-color-default, var(--mod-picker-font-color-key-focus, var(--spectrum-picker-font-color-key-focus)));
}

Expand Down
2 changes: 1 addition & 1 deletion components/picker/themes/spectrum-two.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
--spectrum-picker-background-color-active: var(--spectrum-gray-200);
--spectrum-picker-background-color-key-focus: var(--spectrum-gray-200);

--spectrum-picker-border-color-default: var(--spectrum-gray-800);
--spectrum-picker-border-color-default: var(--spectrum-gray-500);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were using the wrong border color for the default picker.

--spectrum-picker-border-color-default-open: var(--spectrum-gray-500);
--spectrum-picker-border-color-hover: var(--spectrum-gray-600);
--spectrum-picker-border-color-hover-open: var(--spectrum-gray-900);
Expand Down
4 changes: 2 additions & 2 deletions components/stepper/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
".spectrum-Stepper.spectrum-Stepper--sizeS",
".spectrum-Stepper.spectrum-Stepper--sizeXL",
".spectrum-Stepper:before",
".spectrum-Stepper:hover:not(.is-invalid, .is-disabled)",
".spectrum-Stepper:hover:not(.is-invalid, .is-disabled, .is-focused)",
".spectrum-Stepper:not(.is-disabled) .is-focused",
".spectrum-Stepper:not(.is-disabled) .is-focused:hover",
".spectrum-Stepper:not(.is-disabled):focus",
Expand Down Expand Up @@ -125,7 +125,7 @@
"--spectrum-focus-indicator-color",
"--spectrum-focus-indicator-gap",
"--spectrum-focus-indicator-thickness",
"--spectrum-gray-25",
"--spectrum-gray-100",
"--spectrum-gray-300",
"--spectrum-gray-50",
"--spectrum-gray-500",
Expand Down
2 changes: 1 addition & 1 deletion components/stepper/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
--mod-textfield-border-color-disabled: var(--spectrum-stepper-border-color-disabled);
}

&:hover:not(.is-invalid, .is-disabled) {
&:hover:not(.is-invalid, .is-disabled, .is-focused) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to clarify, this means that we do not want the border color on the stepper to lighten (or I guess darken, in dark mode) when we hover when it's focused, right? So visually focus + hover should look the same as focus only?

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much, yes. In the focus state, we do not want the borders (any of the borders) to be --spectrum-stepper-border-color-hover- we would want --spectrum-stepper-border-color-focus-hover. This was another bug Matt Davey found from before foundations was merged. You can really see it in dark mode, where the infield button border color is black (or almost black?) when hovering over the focus state. Currently, on production, the focus+hover and keyboardFocus+hover are less apparent, but still incorrect.

But yes- we do not want the hover border color to take over. We should see the focus-hover border color instead.

--mod-infield-button-border-color: var(--mod-stepper-buttons-border-color-hover, var(--spectrum-stepper-buttons-border-color-hover));
}

Expand Down
2 changes: 1 addition & 1 deletion components/stepper/themes/spectrum-two.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
--spectrum-stepper-buttons-border-style: none;
--spectrum-stepper-buttons-border-width: 0;
--spectrum-stepper-buttons-border-color: var(--spectrum-gray-500);
--spectrum-stepper-buttons-background-color: var(--spectrum-gray-25);
--spectrum-stepper-buttons-background-color: var(--spectrum-gray-100);
--spectrum-stepper-buttons-border-color-hover: var(--spectrum-gray-600);
--spectrum-stepper-buttons-border-color-focus: var(--spectrum-gray-800);
--spectrum-stepper-buttons-border-color-keyboard-focus: var(--spectrum-gray-900);
Expand Down
Loading