-
Notifications
You must be signed in to change notification settings - Fork 201
fix(stepper): clarify mod definitions #3670
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
fix(stepper): clarify mod definitions #3670
Conversation
in express, for focus-hover-invalid was defined as transparent, but that looks like a bug.
- updates metadata - updates some selectors for bug fixes and easier translation in swc
|
2e9834f
to
ed0a922
Compare
@@ -38,7 +38,6 @@ | |||
/** Invalid **/ | |||
--spectrum-stepper-border-color-invalid: transparent; | |||
--spectrum-stepper-border-color-focus-invalid: transparent; | |||
--spectrum-stepper-border-color-focus-hover-invalid: transparent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: this was looking like a bug on focus+hover. double check if this change is necessary any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-hover, var(--spectrum-stepper-border-color-keyboard-focus))); | ||
--mod-textfield-border-color-hover: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-hover, var(--spectrum-stepper-border-color-keyboard-focus))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes correct some keyboard focus hover border colors.
For a keyboard focused stepper, we were relying on the regular hover border color (which is gray-600, I believe):

It's now changed to gray-800 (just keeping the keyboard focus color even on hover), but is that correct? It felt like a bug, but that is how textfield, combobox, and picker all work. However, with this update, the default stepper now behaves like the invalid default stepper, where the keyboard focus border color does not respond to hovering or not.

🚀 Deployed on https://pr-3670--spectrum-css.netlify.app |
File metricsSummaryTotal size: 2.25 MB* Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
File change detailsstepper
tokens
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
} | ||
} | ||
|
||
&.is-keyboardFocused { | ||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-keyboard-focus, var(--spectrum-stepper-border-color-keyboard-focus))); | ||
--mod-textfield-border-color-keyboard-focus: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-keyboard-focus, var(--spectrum-stepper-border-color-keyboard-focus))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm remembering correctly, following the variables in dev tools, I noticed that this textfield mod was undefined. Adding it here fixed what seemed like a styling bug, where the buttons and textfields were behaving differently between the default & invalid variants.
Production:
Screen.Recording.2025-04-15.at.2.00.03.PM.mov
This branch:
Screen.Recording.2025-04-15.at.2.01.56.PM.mov
@@ -254,15 +256,18 @@ | |||
/* stylelint-disable-next-line max-nesting-depth -- @todo reduce complexity of selectors */ | |||
&:hover { | |||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-hover, var(--spectrum-stepper-border-color-focus-hover))); | |||
--mod-textfield-border-color-focus: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-hover, var(--spectrum-stepper-border-color-focus-hover))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A similar situation here as described above, where this textfield mod was actually the mod we needed for the focus+hover. It was undefined when I looked through dev tools.
|
||
&:hover { | ||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-hover-invalid, var(--spectrum-stepper-border-color-focus-hover-invalid))); | ||
--mod-textfield-border-color-invalid-hover: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-hover-invalid, var(--spectrum-stepper-border-color-focus-hover-invalid))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another similar finding, that we were missing a textfield mod in the invalid state.
--mod-infield-button-border-color: var(--mod-stepper-buttons-border-color-focus-hover, var(--spectrum-stepper-buttons-border-color-focus-hover)); | ||
--mod-textfield-focus-indicator-width: 0; | ||
--mod-textfield-border-color: var(--highcontrast-stepper-border-color-focus-hover, var(--mod-stepper-border-color-focus-hover, var(--spectrum-stepper-border-color-focus-hover))); | ||
--mod-infield-button-border-color: var(--mod-stepper-buttons-border-color-focus-hover, var(--spectrum-stepper-border-color-focus-hover)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplest solution to this border color issue was using --spectrum-stepper-border-color-focus-hover, instead of --spectrum-stepper-buttons-border-color-focus-hover
. That kept coming up undefined, even though it was in the spectrum-two.css
file.
--mod-textfield-border-color: var(--highcontrast-stepper-border-color-focus-hover, var(--mod-stepper-border-color-focus-hover, var(--spectrum-stepper-border-color-focus-hover))); | ||
--mod-infield-button-border-color: var(--mod-stepper-buttons-border-color-focus-hover, var(--spectrum-stepper-border-color-focus-hover)); | ||
--mod-textfield-focus-indicator-width: var(--mod-stepper-focus-indicator-width, 0); | ||
--mod-textfield-border-color-focus: var(--mod-stepper-border-color-focus, var(--spectrum-stepper-border-color-focus-hover)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mod for just the textfield border wasn't working, but changing it to the focus border mod did. 🤷♀️
&:hover:not(.is-invalid, .is-disabled, .is-focused, .is-keyboardFocused) { | ||
--mod-infield-button-border-color: var(--mod-stepper-buttons-border-color-hover, var(--spectrum-stepper-buttons-border-color-hover)); | ||
} | ||
|
||
&:not(.is-disabled) { | ||
.is-focused, | ||
&.is-focused, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since number field has been tricky as of late, can we update these selectors?
I'm pretty sure both of these selector changes were updated in this PR (we deprioritized a couple of months ago, that's all).
mod in question already had other mods within their definitions that customers can target to customize. No action needed 😊 tied/related to #3558 |
Description
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
Regression testing
Validate:
Screenshots
To-do list