feat(link): 2nd-gen template, stories, styling#6326
Conversation
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
cdransf
left a comment
There was a problem hiding this comment.
Looks good! Just a few minor things. ✨
5t3ph
left a comment
There was a problem hiding this comment.
Great start here!
The comments I have on link would apply to global-link as well.
| background-color: transparent; | ||
| cursor: pointer; | ||
| outline: none; |
There was a problem hiding this comment.
Looks like this removal was missed
5t3ph
left a comment
There was a problem hiding this comment.
The output is looking good! The biggest thing is the typography generator needs updated.
Also I realized this is going to main but the PR description notes that documentation and tests are not complete. Would you prefer to finish those now, or aim this at a feature branch instead?
| @media (forced-colors: active) { | ||
| a:where(:not([class])) { | ||
| color: LinkText; | ||
| } | ||
| } |
There was a problem hiding this comment.
This can be removed as it's the browser default
| const wrapperSelectors = `${wrapper} ${anchor}`; | ||
| const stateSelectors = (pseudo) => `${wrapper} ${anchor}${pseudo}`; | ||
|
|
||
| const baseDecls = pickValidDecls({ |
There was a problem hiding this comment.
The typography stylesheet is correct but it looks like it was manually edited instead of the generator being updated. Please sync the updates we made to the output to how the generator is creating those rules otherwise they will change on the next tokens update.
Description
Implements Phases 2–5 of the Link 2nd-gen migration (washing-machine workflow): setup, public API direction, accessibility policy documentation, and S2 styling. Phase 6 (testing) and full Phase 7 (documentation) are not in scope — Storybook stories, migration guide, and Typography cross-links are included only as a visual validation scaffold and will be refined in a follow-up PR along with dedicated a11y verification and automated tests.
Link is an atypical migration: there is no
swc-linkcustom element and no core package. Delivery is CSS + native<a href>, aligned with migration plan and PR 6304 packaging review.2nd-gen files added or updated (
2nd-gen/packages/):Stylesheets
swc/stylesheets/link.css— S2 link presentation migrated fromspectrum-cssspectrum-two(components/link/index.css); BEM modifiers (.swc-Link,--secondary,--quiet+--standalone,--staticWhite,--staticBlack,--inline);--swc-*custom properties (no--mod-*)swc/stylesheets/global/global-link.css— opt-in baseline for bare<a>(no cascade layer; importslink.cssfor modifiers)swc/stylesheets/typography.css— regenerated; default anchor rules for.swc-Typography--proseand.swc-Typography--linksvia:where(a)tools/swc-tokens/src/typography.js— generator appends prose/links anchor block (no@importoflink.cssinto typography)Documentation (scaffold — Phase 7 follow-up)
swc/components/link/migration-guide.mdx—sp-link→ native<a>, import paths, attribute→class mapping, a11y policy calloutsswc/components/link/stories/link.stories.ts+link.template.ts— Playground + option stories for standalone / prose / link-list contexts (visual review only)swc/components/typography/migration-guide.mdx— links section; cross-link to Link guideswc/components/typography/stories/typography.stories.ts— inline link in Prose story;LinkListstory (swc-Typography--links)Packaging / Storybook
swc/package.json— exports forlink.cssandglobal-link.cssswc/.storybook/preview.ts— importslink.cssswc/.storybook/preview-head.html—.link-sampleslayout utilitiesMotivation and context
Part of the 1st-gen → 2nd-gen component migration workstream. Epic SWC-1956.
Key architectural decisions in this PR (see migration plan for full rationale):
<a>only — no transitionalsp-link/ CE; prose and link lists use Typography wrapperslink.cssholds explicit BEM modifiers;typography.css(generator) supplies default unclassed anchor appearance inside.swc-Typography--proseand.swc-Typography--linkswith:where(a)so modifier classes can overrideglobal-link.cssis opt-in for app-wide bare<a>baseline — not bundled inswc.css, intentionally outside cascade layers.swc-Link--quiet.swc-Link--standalone(section-scoped pattern; not for undifferentiated body prose)variantlike 1st-gendisabledon navigational links — documented in migration guide (SWC-966)Related issue(s)
Out of scope (follow-up PR)
Manual review test cases
Stylesheets
@adobe/spectrum-wc/link.cssand@adobe/spectrum-wc/typography.css; confirm standalone.swc-Linkmodifiers (default, secondary, static white/black, quiet+standalone) match S2 intent.swc-Typography--prose, unclassed<a href>inherits body typography and shows default link color/underline/focus ring.swc-Typography--links, three list links render with default styling (Typography Link list story and Link Link list story)@adobe/spectrum-wc/global-link.css— bare<a>without classes pick up standalone link presentationGenerator / packaging
yarn workspace @adobe/spectrum-wc stylesheet:typographyregeneratestypography.csswith the prose/links:where(a)block; no@importoflink.cssin typography outputyarn workspace @adobe/spectrum-wc buildemitsdist/link.cssanddist/global-link.cssStorybook scaffold (visual only)
Migration docs
sp-linkattributes to BEM classes and Typography import pathsAccessibility testing checklist
Full keyboard and screen reader testing is deferred to the Phase 6/7 follow-up PR (native
<a>behavior, focus-visible in prose, quiet usage scope). Reviewers can verify policy direction from docs/code:<a href>for navigation; nodisabledon links; quiet scoped to section patterns; icon-only links need accessible names:focus-visibleoutline (not deprecated double-underline-only focus from 1st-gen)sp-link/ shadow-DOM focus delegation — activation target is the author’s native anchor