-
Notifications
You must be signed in to change notification settings - Fork 202
feat(tabs): migrate to spectrum 2 #4003
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
base: spectrum-two
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: aedde76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch previewPR #4003 has been deployed to Azure Blob Storage: https://spectrumcss.z13.web.core.windows.net/pr-4003/index.html. |
File metricsSummaryTotal size: 1.42 MB*
tabs
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
b0c1a1b
to
0d1f3f9
Compare
@@ -165,81 +96,97 @@ | |||
|
|||
/* Friends should align to the top of the tabs */ | |||
vertical-align: top; | |||
|
|||
background: linear-gradient(to var(--mod-tabs-list-background-direction, var(--spectrum-tabs-list-background-direction)), var(--highcontrast-tabs-divider-background-color, var(--mod-tabs-divider-background-color, var(--spectrum-tabs-divider-background-color))) 0 var(--mod-tabs-divider-size, var(--spectrum-tabs-divider-size)), transparent var(--mod-tabs-divider-size, var(--spectrum-tabs-divider-size))); |
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.
I'm not clear on what this linear gradient's purpose was initially, but since we don't have a divider anymore, I pulled it out.
/* @todo: set transition: none for initial positioning */ | ||
transition: transform var(--spectrum-tabs-animation-duration) var(--spectrum-tabs-animation-ease); |
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.
So, I'm not sure about the transition effects here. We don't have a great way to test them because we don't have an implementation here that transitions the selection indicator (the selection indicator should animate as it switches from one selected tab to another). This is pretty much what was here before so I'm hopeful that I didn't break anything.
I also noticed combing through SWC's CSS for Tabs that they're programmatically setting a `first-position' class that has no transition, not sure if that's something we'd eventually want to add here but it seems like we'd want a bit more consensus (or even just a bit more of a feedback loop) to decide on how we'll do this.
} | ||
|
||
&.spectrum-Tabs--compact { | ||
/* The ActionButton is taller than the tabs, so don't push tabs around */ | ||
/* The overflow ActionButton is taller than the tabs, so don't push tabs around */ |
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 overflow tabs in SWC use an action button for the arrows, I'm assuming that's what's meant here.
It works perfectly fine currently to set --mod custom properties in order to achieve variants, but since we've previously spoken of removing --mods, it seems more wise to use a different pattern. This pattern, similar to what's seen in button and actionbutton, is to change the definition of the custom property in order to achieve the variant.
As the variants are setting mods at the top level, it feels more natural to set mods for the default variant at the top as well. This is helped by the fact that there are no longer t-shirt sizes for tabs.
- Rename some custom properties: - --spectrum-tabs-selected-item-thickness/--mod-tabs-selected-item-thickness --> --spectrum/--mod-tabs-selection-indicator-thickness - --mod-tabs-divider-border-radius --> --mod-tabs-selection-indicator-border-radius - change the order of some custom properties - add intended token values for undefined/misdefined tokens, including for mobile - add a .spectrum--large selector to override some tokens for large viewports
- Adjusts the calcs for the focus indicator to match the token spec - Switches inset-inline to margin to better align the approach with what's seen in the breadcrumb component - Adds some light adjustments to the template (roles, tabindex)
- Simplify selection indicator markup in template - Moves inline selection indicator styles from template to index.css
73c6fad
to
0a9875f
Compare
- add a passthrough for picker so compact and regular overflow look different instead of exactly the same - change the corner radius for the focus indicator because there wasn't one on the spec but it looks like it's 6px, not 4px... the comment about calcs in the figma spec doesn't make sense to me so @todo I'll have to ask about that later - changed ::before inset-inline-start for the default variant, so updates it in --vertical variants as well - fixes undefined icon that was showing up as a circle in stories.js - add tests to grid for hover colors, with necessary support in template - add tests to grid for focus indicator, with necessary support in template - add gap rather than confusing margin-inline-start rule - add notes within the comments to clarify things that may not be as obvious within the context of css only - moves selection indicator margin-block-start to scope only to horizontal variant
Looking at WHCM revealed a few issues: - disabled selection indicator color was not being applied; instead disabled selected tab text was a different color - would have been great to have a test for disabled items, better late than never - we were setting an unneeded margin-inline-start on the focus indicator for the vertical variant that made WHCM look a little off - other refactoring and simplificaion of WHCM styles
0a9875f
to
aedde76
Compare
Description
Tabs Spectrum 2 Migration
Tabs is an S2 migration that is quite pared down compared to its S1 counterpart. Removed features & variants for S2 include:
Other changes and updates for S2:
--mod-tabs-divider-size
to--spectrum-tabs-selected-item-thickness
to--mod-tabs-selection-indicator-thickness
;--mod-tabs-divider-border-radius
-->--mod-tabs-selection-indicator-border-radius
)Notes:
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