diff --git a/packages/lab/src/skip-link/SkipLink.css b/packages/lab/src/skip-link/SkipLink.css index da55c1c1650..3e37e8be616 100644 --- a/packages/lab/src/skip-link/SkipLink.css +++ b/packages/lab/src/skip-link/SkipLink.css @@ -1,20 +1,3 @@ -/* CSS Variables for the Skip Link */ -.saltSkipLink { - --skipLink-padding: var(--saltSkipLink-padding, var(--salt-size-unit)); - --skipLink-margin: var(--saltSkipLink-margin, var(--salt-size-unit)); - --skipLink-background: var(--saltSkipLink-background, var(--salt-actionable-primary-background)); - --skipLink-color: var(--saltSkipLink-color, var(--salt-content-primary-foreground)); -} - -/* Overrides */ -.saltSkipLink { - --saltLink-color-focus: var(--skipLink-color); -} - -.saltSkipLink-target { - --skipLink-target-focus: var(--salt-focused-outline); -} - /*Styles applied when the link is focused to hide the Skip Link when not in focus*/ .saltSkipLink { top: 0; @@ -31,22 +14,15 @@ .saltSkipLink:focus { opacity: 1; width: auto; - height: auto; + height: max(var(--salt-size-base), auto); white-space: nowrap; - margin: var(--skipLink-margin); - padding: calc(var(--skipLink-padding) - 1px) var(--skipLink-padding) var(--skipLink-padding); - background: var(--skipLink-background); - color: var(--skipLink-color); - box-shadow: var(--salt-overlayable-shadow-popout); -} - -.saltSkipLink { - font-size: var(--salt-text-fontSize); - font-family: var(--saltSkipLink-fontFamily, var(--salt-text-fontFamily)); - line-height: var(--saltSkipLink-lineHeight, var(--salt-text-lineHeight)); + background: var(--saltSkipLink-background, var(--salt-container-primary-background)); + padding: var(--salt-spacing-100) var(--salt-spacing-300); + box-shadow: var(--salt-overlayable-shadow); + outline-offset: calc(-1 * var(--salt-focused-outlineWidth)); } -/*Styles applied to the skip link focus target*/ -.saltSkipLink-target { - outline: var(--skipLink-target-focus); +.saltSkipLink.saltLink:focus, .saltSkipLink.saltLink:hover { + text-decoration: var(--salt-navigable-textDecoration); + color: var(--salt-content-primary-foreground); } diff --git a/packages/lab/src/skip-link/SkipLink.tsx b/packages/lab/src/skip-link/SkipLink.tsx index 3c8359c2ff5..ef107606d3e 100644 --- a/packages/lab/src/skip-link/SkipLink.tsx +++ b/packages/lab/src/skip-link/SkipLink.tsx @@ -2,7 +2,7 @@ import { Link, type LinkProps, makePrefixer } from "@salt-ds/core"; import { useComponentCssInjection } from "@salt-ds/styles"; import { useWindow } from "@salt-ds/window"; import { clsx } from "clsx"; -import { type RefObject, forwardRef } from "react"; +import { forwardRef, type RefObject } from "react"; import { useManageFocusOnTarget } from "./internal/useManageFocusOnTarget"; import skipLinkCss from "./SkipLink.css"; diff --git a/packages/lab/src/skip-link/SkipLinks.css b/packages/lab/src/skip-link/SkipLinks.css index 763cbb7604a..1752a3e4145 100644 --- a/packages/lab/src/skip-link/SkipLinks.css +++ b/packages/lab/src/skip-link/SkipLinks.css @@ -3,5 +3,4 @@ float: left; list-style: none; margin: 0; - padding: 0; } diff --git a/packages/lab/stories/skip-link/skip-link.stories.tsx b/packages/lab/stories/skip-link/skip-link.stories.tsx index 1f264821f8d..3106a6d5916 100644 --- a/packages/lab/stories/skip-link/skip-link.stories.tsx +++ b/packages/lab/stories/skip-link/skip-link.stories.tsx @@ -1,8 +1,15 @@ -import { Button } from "@salt-ds/core"; +import { + Button, + Divider, + H2, + H3, + SplitLayout, + StackLayout, + Text, +} from "@salt-ds/core"; import { SkipLink, SkipLinks } from "@salt-ds/lab"; import type { Meta, StoryFn } from "@storybook/react"; import { useRef } from "react"; -import "./skip-link.stories.css"; export default { title: "Lab/Skip Link", @@ -13,30 +20,22 @@ export const Default: StoryFn = () => { const articleRef = useRef(null); return ( - <> - + + Click here and press the Tab key to see the Skip Link - -
+ +
Skip to main content - -
- What we do -
+ +

What we do

-

Salt

+

Salt

Salt provides you with a suite of UI components and a flexible theming system. With no customisation, the default theme offers an @@ -47,7 +46,7 @@ export const Default: StoryFn = () => {

-

Goals

+

Goals

Salt has been developed with the following design goals:

  • @@ -60,11 +59,9 @@ export const Default: StoryFn = () => {
-
- -
+ Next} />
- + ); }; @@ -73,11 +70,11 @@ export const MultipleLinks: StoryFn = () => { const sectionRef2 = useRef(null); return ( - <> - + + Click here and press the Tab key to see the Skip Link - -
+ +
Skip to Introduction @@ -86,20 +83,12 @@ export const MultipleLinks: StoryFn = () => { Skip to Goals - -
- What we do -
+ +

What we do

-
-

Salt

+
+

Salt

Salt provides you with a suite of UI components and a flexible theming system. With no customisation, the default theme offers an @@ -110,7 +99,7 @@ export const MultipleLinks: StoryFn = () => {

-

Goals

+

Goals

Salt has been developed with the following design goals:

  • @@ -123,10 +112,8 @@ export const MultipleLinks: StoryFn = () => {
-
- -
+ Next} />
- + ); };