Repository navigation
fix!: SLDS 2 linter fixes for legacy classes and hardcoded styles - #3366
Merged
Merged
Conversation
… line-height Replace the hardcoded 1px border on the swatch radio label with var(--slds-g-sizing-border-1, 1px), and the tooltip trigger's line-height 1 with var(--slds-g-font-line-height-1, 1). Both hooks resolve to the same values in the SLDS 2 (2.264.1) Cosmos and Lightning Blue themes, so rendering is unchanged.
The carousel panel action hardcoded background-color: white, so it ignored the theme's surface color (e.g. Cosmos dark mode). Use var(--slds-g-color-surface-1, white), the hook SLDS 2 itself uses for .slds-carousel__content, keeping white as the fallback.
SLDS 2 ships no skeleton or stencil blueprint, so the loading bars keep their inline styles but read the color, spacing, sizing and pill radius from --slds-g-* global hooks, with the previous values as fallbacks.
The story passed a loadingStencil prop that the example ignores, so it never showed the skeleton. Use sample data where Nuts is expanded and loading. The flag is static, not timer-driven, so the story is stable in visual regression runs.
…y theme classes Alert always added slds-theme_alert-texture, which SLDS 2 (2.264.1) does not define, and themed each variant with the slds-theme_* utilities. The SLDS alert blueprint only uses those on its legacy path; the current markup is slds-notify slds-notify_alert plus slds-alert_warning, slds-alert_error or slds-alert_offline, with info as the default. Those classes set the --slds-c-alert-* hooks the SLDS 2 alert CSS reads. Rendering is unchanged except offline, which now uses the alert component's neutral-base-50 background instead of the utility's neutral-base-30.
A prompt Modal added slds-theme_alert-texture to its header, a class SLDS 2 (2.264.1) does not define, so it did nothing. SLDS 2's prompt blueprint styles the header through .slds-modal_prompt and the slds-theme_<prompt> utility, which Modal still applies. The SLDS React ESLint plugin missed it because the class is added inside classNames(). Add a regression test.
…t="global-header" iconVariant="global-header" added slds-global-header__button_icon to the button and slds-global-header__icon to the SVG. SLDS 2 (2.264.1) defines neither. Its global header CSS styles action buttons via slds-global-actions__item-action (icon fill, size, hover/active/focus), and the blueprint puts that class on every header action button. Use it on the button and drop the icon class, which has no SLDS 2 equivalent: the size and fill come from the button and slds-global-actions__item rules. Add a GlobalHeaderIcon story that renders the button inside the global header markup, since no story covered this variant.
…icon A tab with hasError passed containerClassName="slds-icon_container slds-icon-utility-error" to its error icon. SLDS 2 (2.264.1) does not define slds-icon-utility-error. The SLDS tabs blueprint renders the error icon as a plain slds-icon_container around an slds-icon_x-small slds-icon-text-error SVG, which Icon already produces with colorVariant="error". Keep only slds-icon_container, and point the test at slds-icon-text-error. Add a WithErrorTab story, since no story covered hasError.
styles/tabs/tab.css was opt-in CSS for disabled tabs that 0.10.x told consumers to import from the package. v11 publishes only dist, so the file no longer ships, and nothing in the repo imports it. It overrode slds-tabs_*__link and slds-has-focus with a hardcoded color, which the SLDS linter flags (no-slds-class-overrides). Also drop the stale comment in the private Tab component that pointed at it. Rendered markup is unchanged: a disabled tab still gets slds-disabled and aria-disabled="true". BREAKING CHANGE: styles/tabs/tab.css is removed. Remove any import of it; SLDS 2 does not style disabled tabs, so add your own CSS for .slds-disabled tab items if you need a visual cue.
Niznikr
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #
Additional description
SLDS 2 (2.264.1) linter findings: legacy classes that SLDS 2 doesn't define, and hardcoded values that should read SLDS 2 styling hooks. Each fix is its own commit:
--slds-g-*hooks, with the old values as fallbacks. Rendering is unchanged.--slds-g-color-surface-1instead ofwhite, so it follows the theme's surface color (for example Cosmos dark mode).--slds-g-*hooks, since SLDS 2 has no skeleton blueprint. The "Base with stencil" story now actually renders the skeleton: it passed a prop the example ignored.slds-alert_warning,slds-alert_error,slds-alert_offline) instead ofslds-theme_alert-textureandslds-theme_*. Rendering is unchanged except offline, which now gets the alert component's neutral background.slds-theme_alert-texture, which SLDS 2 doesn't define. The ESLint plugin missed this one because the class was insideclassNames(), so there's a regression test.iconVariant="global-header"usesslds-global-actions__item-actioninstead of the undefinedslds-global-header__button_iconandslds-global-header__iconclasses. Adds a GlobalHeaderIcon story.slds-icon-utility-error, which SLDS 2 doesn't define. Adds a WithErrorTab story.styles/tabs/tab.css, the opt-in disabled-tab stylesheet from 0.10.x. v11 publishes onlydist, so the file no longer shipped, and it overrode SLDS classes. Remove any import of it. SLDS 2 doesn't style disabled tabs, so add your own CSS for.slds-disabledtab items if you need a visual cue.Story snapshots are updated, and the regression tests are in each commit.
CONTRIBUTOR checklist (do not remove)
Please complete for every pull request.
Green gate — all of these must pass locally (CI runs the same):
npm run lintpasses with 0 errors and 0 warnings (npm run lint:fixto auto-fix).npm run typecheckis clean (tsc --noEmit).npm test -- --runpasses — this runs both Vitest projects (jsdomunit+ real-browserbrowser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots withnpm test -- --run -uand review the diff.npm run buildsucceeds (type-check + Vite library build +.d.ts+ entry shims).Behavior & docs:
components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a*.browser.test.jsxfile (thebrowserproject); everything else is jsdom.npm run storybook→ http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server).content/visualPickerFigure, render props likerenderItem,iconprops,events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check againstcomponents/<name>/__examples__..d.ts(they're generated by the build); JS consumers rely on them via editor type-acquisition.REVIEWER checklist (do not remove)
CIworkflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).@salesforce/design-system-react/components/<name>and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change →feat!:/BREAKING CHANGE:and a major version bump.