From f31471748ade74ba76e1ea4f8dd27a4145334c01 Mon Sep 17 00:00:00 2001 From: barsnes Date: Mon, 24 Jun 2024 12:46:40 +0200 Subject: [PATCH] temavelger a11y updates --- apps/storefront/components/Header/Header.tsx | 6 +- apps/theme/components/Color/Color.module.css | 4 +- apps/theme/components/Color/Color.tsx | 2 +- .../components/ColorModal/ColorModal.tsx | 6 +- .../ColorPicker/ColorPicker.module.css | 8 ++- .../components/ColorPicker/ColorPicker.tsx | 11 ++-- apps/theme/components/CopyBtn/CopyBtn.tsx | 8 ++- .../theme/components/Header/Header.module.css | 23 ++++--- apps/theme/components/Header/Header.tsx | 64 +++++++++++++------ .../components/Previews/Previews.module.css | 16 ++--- apps/theme/components/Previews/Previews.tsx | 11 ++++ 11 files changed, 101 insertions(+), 58 deletions(-) diff --git a/apps/storefront/components/Header/Header.tsx b/apps/storefront/components/Header/Header.tsx index 2867d22018..9f53763a6d 100644 --- a/apps/storefront/components/Header/Header.tsx +++ b/apps/storefront/components/Header/Header.tsx @@ -41,7 +41,7 @@ const Header = () => {
setOpen(false)} @@ -107,7 +107,7 @@ const Header = () => { @@ -117,7 +117,7 @@ const Header = () => { diff --git a/apps/theme/components/Color/Color.module.css b/apps/theme/components/Color/Color.module.css index 145343d50f..f03aab30fb 100644 --- a/apps/theme/components/Color/Color.module.css +++ b/apps/theme/components/Color/Color.module.css @@ -8,10 +8,10 @@ font-weight: 400; border: 1px solid #e4e4e4; border-radius: 4px; + cursor: pointer; } -.box:hover { - cursor: pointer; +.box:hover:not(:focus-visible) { border-color: #fff; outline: 2px solid #535353; outline-offset: 1px; diff --git a/apps/theme/components/Color/Color.tsx b/apps/theme/components/Color/Color.tsx index 865227ef6c..347278fd96 100644 --- a/apps/theme/components/Color/Color.tsx +++ b/apps/theme/components/Color/Color.tsx @@ -41,7 +41,7 @@ const Color = ({ ); }} style={{ backgroundColor: color.hex }} - className={cl(classes.box, featured && classes.featured)} + className={cl(classes.box, featured && classes.featured, 'ds-focus')} > {showColorMeta && ( diff --git a/apps/theme/components/ColorModal/ColorModal.tsx b/apps/theme/components/ColorModal/ColorModal.tsx index 2d72c230b3..031b7459eb 100644 --- a/apps/theme/components/ColorModal/ColorModal.tsx +++ b/apps/theme/components/ColorModal/ColorModal.tsx @@ -1,4 +1,4 @@ -import { Modal } from '@digdir/designsystemet-react'; +import { Modal, Paragraph } from '@digdir/designsystemet-react'; import type { ColorInfo, ColorType } from '@digdir/designsystemet/color'; import { getCssVariable, hexToHSL } from '@digdir/designsystemet/color'; @@ -22,8 +22,8 @@ const Field = ({ }) => { return (
-
{label}
-
{value}
+ {label} + {value} {copyBtn && }
); diff --git a/apps/theme/components/ColorPicker/ColorPicker.module.css b/apps/theme/components/ColorPicker/ColorPicker.module.css index 65f7d3fccd..99b2207249 100644 --- a/apps/theme/components/ColorPicker/ColorPicker.module.css +++ b/apps/theme/components/ColorPicker/ColorPicker.module.css @@ -12,12 +12,14 @@ height: 48px; width: 150px; padding-left: 12px; - transition: 0.04s all; + transition: + 0.04s border, + 0.04s outline; border: 1px solid #c0c0c0; background-color: transparent; } -.container:hover { +.container:hover:not(:focus-visible) { border: 1px solid #3d3d3d; outline: 1px solid #3d3d3d; } @@ -82,6 +84,8 @@ align-items: center; justify-content: center; cursor: pointer; + padding: 0; + overflow: hidden; } .status svg { diff --git a/apps/theme/components/ColorPicker/ColorPicker.tsx b/apps/theme/components/ColorPicker/ColorPicker.tsx index 59ee4684c4..48ca060301 100644 --- a/apps/theme/components/ColorPicker/ColorPicker.tsx +++ b/apps/theme/components/ColorPicker/ColorPicker.tsx @@ -25,7 +25,7 @@ export const ColorPicker = ({ disabled, colorError, }: ColorPickerProps) => { - const [color, setColor] = useState('#0062BA'); + const [color, setColor] = useState('#FFF'); const [showModal, setShowModal] = useState(false); const handleClick = () => { setShowModal(!showModal); @@ -50,9 +50,10 @@ export const ColorPicker = ({ variant={colorError === 'none' ? 'default' : 'warning'} > -
)} -
+
@@ -106,7 +107,7 @@ export const ColorPicker = ({ {getStatus()}
+ ); }; diff --git a/apps/theme/components/Header/Header.module.css b/apps/theme/components/Header/Header.module.css index 343926ebe2..aeeec8df2a 100644 --- a/apps/theme/components/Header/Header.module.css +++ b/apps/theme/components/Header/Header.module.css @@ -7,19 +7,22 @@ height: 34px; } -.links a { - text-decoration: none; +.item { + list-style: none; + margin-left: var(--ds-spacing-7); +} + +.link { color: inherit; - display: block; - margin-left: 32px; - border-bottom: 2px solid transparent; - padding-bottom: 10px; - font-size: 18px; - letter-spacing: 0.1px; + text-decoration: none; + border-bottom: 3px solid transparent; + padding-bottom: var(--ds-spacing-2); + transition: 0.1s border-color ease-out; } -.links a:hover { - border-color: #d4d4d4; +.link:hover, +.link:focus-visible { + border-color: var(--ds-color-neutral-border-subtle); } .container { diff --git a/apps/theme/components/Header/Header.tsx b/apps/theme/components/Header/Header.tsx index 299a6a947b..6bcf73dc4f 100644 --- a/apps/theme/components/Header/Header.tsx +++ b/apps/theme/components/Header/Header.tsx @@ -1,5 +1,6 @@ import Link from 'next/link'; import { usePathname } from 'next/navigation'; +import cl from 'clsx/lite'; import { Container } from '../Container/Container'; @@ -11,7 +12,10 @@ export const Header = () => {
- + {
Beta
-
- - Fargevelger - - - Testside - - - Om verktøyet - -
+
    +
  • + + Fargevelger + +
  • +
  • + + Testside + +
  • +
  • + + Om verktøyet + +
  • +
); diff --git a/apps/theme/components/Previews/Previews.module.css b/apps/theme/components/Previews/Previews.module.css index c1ab09eb06..d0260b37f6 100644 --- a/apps/theme/components/Previews/Previews.module.css +++ b/apps/theme/components/Previews/Previews.module.css @@ -19,19 +19,19 @@ border-radius: 500px; border: none; background-color: transparent; + color: var(--ds-color-accent-text-default); } .menuItem:hover { cursor: pointer; - background-color: #e1ecff; + background-color: var(--ds-color-accent-4); } .menuItemActive { - background-color: #e1ecff; + background-color: var(--ds-color-accent-3); } -.menuItemDisabled, -.menuItemDisabled:hover { +.menuItem[aria-disabled] { cursor: not-allowed; opacity: 0.6; background-color: transparent !important; @@ -53,15 +53,16 @@ padding: 9px 16px; font-size: 15px; border-radius: 500px; + color: var(--ds-color-accent-text-default); } .toggle:hover { cursor: pointer; - background-color: #dae7ff; + background-color: var(--ds-color-accent-4); } .active { - background-color: #d8e6ff; + background-color: var(--ds-color-accent-3); } .toggle img { @@ -72,12 +73,11 @@ --background: var(--neutral-2); --foreground: var(--neutral-1); - border: 1px solid #ebebeb; width: 100%; border-radius: 12px; display: flex; gap: 32px; - box-shadow: 0 0 20px 2px #ebebeb; + box-shadow: var(--ds-shadow-md); } .preview[data-ds-color-mode='dark'], diff --git a/apps/theme/components/Previews/Previews.tsx b/apps/theme/components/Previews/Previews.tsx index c10f0960f6..09f61e9530 100644 --- a/apps/theme/components/Previews/Previews.tsx +++ b/apps/theme/components/Previews/Previews.tsx @@ -29,6 +29,7 @@ export const Previews = ({ themeMode, onThemeModeChange }: PreviewsProps) => { @@ -76,6 +84,7 @@ export const Previews = ({ themeMode, onThemeModeChange }: PreviewsProps) => {