-
Notifications
You must be signed in to change notification settings - Fork 207
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,7 @@ | |
|
||
&.is-keyboardFocused { | ||
/* quiet focus indicator only on bottom border */ | ||
--mod-stepper-focus-indicator-visibility: visible; | ||
--mod-stepper-focus-indicator-visibility: var(--mod-stepper-focus-indicator-visibility-keyboard-focus, visible); | ||
} | ||
} | ||
|
||
|
@@ -170,29 +170,28 @@ | |
--mod-textfield-border-color-disabled: var(--spectrum-stepper-border-color-disabled); | ||
} | ||
|
||
&:hover:not(.is-invalid, .is-disabled, .is-focused) { | ||
&: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, | ||
&:focus { | ||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color-focus, var(--mod-stepper-buttons-border-color-focus, var(--spectrum-stepper-buttons-border-color-focus))); | ||
--mod-textfield-focus-indicator-width: 0; | ||
--mod-textfield-focus-indicator-width: var(--mod-stepper-focus-indicator-width, 0); | ||
|
||
&:hover { | ||
/* stylelint-disable-next-line spectrum-tools/no-unknown-custom-properties -- allows for --spectrum-stepper-buttons-border-color-focus-hover to be defined outside of current context */ | ||
--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 commentThe 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 |
||
--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 commentThe 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. 🤷♀️ |
||
} | ||
} | ||
|
||
&.is-keyboardFocused, | ||
&:focus-visible { | ||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color-keyboard-focus, var(--mod-stepper-buttons-border-color-keyboard-focus, var(--spectrum-stepper-buttons-border-color-keyboard-focus))); | ||
--mod-textfield-focus-indicator-width: 0; | ||
--mod-textfield-border-color: var(--highcontrast-stepper-border-color-keyboard-focus, var(--mod-stepper-border-color-keyboard-focus, var(--spectrum-stepper-border-color-keyboard-focus))); | ||
--mod-textfield-focus-indicator-width: var(--mod-stepper-focus-indicator-width, 0); | ||
--mod-textfield-border-color-hover: var(--highcontrast-stepper-border-color-keyboard-focus, var(--mod-stepper-border-color-keyboard-focus, var(--spectrum-stepper-border-color-keyboard-focus))); | ||
|
||
/* keyboard focus indicator is visible */ | ||
outline: var(--spectrum-stepper-focus-indicator-width) solid; | ||
|
@@ -207,14 +206,17 @@ | |
|
||
&:hover { | ||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-hover-invalid, var(--spectrum-negative-border-color-hover))); | ||
--mod-textfield-border-color-hover: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-hover-invalid, var(--spectrum-stepper-border-color-focus-hover-invalid))); | ||
} | ||
|
||
&.is-focused, | ||
&:focus { | ||
--mod-infield-button-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-invalid, var(--spectrum-stepper-border-color-focus-invalid))); | ||
--mod-textfield-border-color-focus: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color-focus-invalid, var(--spectrum-stepper-border-color-focus-invalid))); | ||
|
||
&: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 commentThe 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. |
||
} | ||
} | ||
|
||
|
@@ -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 commentThe 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. |
||
} | ||
} | ||
|
||
&.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 commentThe 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.movThis branch: Screen.Recording.2025-04-15.at.2.01.56.PM.mov |
||
|
||
/* 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-hover, var(--spectrum-stepper-border-color-hover))); | ||
--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))); | ||
Comment on lines
+269
to
+270
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. ![]() |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
--spectrum-stepper-border-color-keyboard-focus-invalid: transparent; | ||
|
||
/** Disabled **/ | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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).