From a0812dbaf9d45f7e71603f57598576053eb23c11 Mon Sep 17 00:00:00 2001 From: Aram Limpens Date: Fri, 21 Jun 2024 15:49:25 +0200 Subject: [PATCH 1/2] fix: Use visually hidden as utility class only --- packages/react/src/Avatar/Avatar.tsx | 3 +- .../react/src/ErrorMessage/ErrorMessage.tsx | 5 ++- packages/react/src/Header/Header.tsx | 3 +- packages/react/src/IconButton/IconButton.tsx | 3 +- .../src/SearchField/SearchFieldButton.tsx | 3 +- .../src/SearchField/SearchFieldInput.tsx | 5 ++- .../react/src/TopTaskLink/TopTaskLink.tsx | 3 +- .../src/components/Footer/Footer.stories.tsx | 34 +++++++------------ 8 files changed, 22 insertions(+), 37 deletions(-) diff --git a/packages/react/src/Avatar/Avatar.tsx b/packages/react/src/Avatar/Avatar.tsx index 45e220ddad..b32cb9dfe5 100644 --- a/packages/react/src/Avatar/Avatar.tsx +++ b/packages/react/src/Avatar/Avatar.tsx @@ -9,7 +9,6 @@ import { forwardRef } from 'react' import type { ForwardedRef, HTMLAttributes } from 'react' import { Icon } from '../Icon' import { Image } from '../Image' -import { VisuallyHidden } from '../VisuallyHidden' export const avatarColors = [ 'black', @@ -68,7 +67,7 @@ export const Avatar = forwardRef( ref={ref} className={clsx('ams-avatar', `ams-avatar--${color}`, imageSrc && 'ams-avatar--has-image', className)} > - {a11yLabel} + {a11yLabel} ) diff --git a/packages/react/src/ErrorMessage/ErrorMessage.tsx b/packages/react/src/ErrorMessage/ErrorMessage.tsx index ce9b2e1c0a..95d4f1321d 100644 --- a/packages/react/src/ErrorMessage/ErrorMessage.tsx +++ b/packages/react/src/ErrorMessage/ErrorMessage.tsx @@ -6,7 +6,6 @@ import clsx from 'clsx' import { forwardRef } from 'react' import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' -import { VisuallyHidden } from '../VisuallyHidden' export type ErrorMessageProps = { /** An accessible phrase that screen readers announce before the error message. Should translate to something like ‘input error’. */ @@ -19,10 +18,10 @@ export const ErrorMessage = forwardRef( ref: ForwardedRef, ) => (

- + {prefix} {': '} - + {children}

), diff --git a/packages/react/src/Header/Header.tsx b/packages/react/src/Header/Header.tsx index f5ac29d449..907c46b57b 100644 --- a/packages/react/src/Header/Header.tsx +++ b/packages/react/src/Header/Header.tsx @@ -9,7 +9,6 @@ import type { ForwardedRef, HTMLAttributes, ReactNode } from 'react' import { Heading } from '../Heading' import { Logo } from '../Logo' import type { LogoBrand } from '../Logo' -import { VisuallyHidden } from '../VisuallyHidden' export type HeaderProps = { /** The name of the application. */ @@ -44,7 +43,7 @@ export const Header = forwardRef( <>
- {logoLinkTitle} + {logoLinkTitle} {links &&
{links}
} diff --git a/packages/react/src/IconButton/IconButton.tsx b/packages/react/src/IconButton/IconButton.tsx index 8705e727aa..0a6045ccff 100644 --- a/packages/react/src/IconButton/IconButton.tsx +++ b/packages/react/src/IconButton/IconButton.tsx @@ -8,7 +8,6 @@ import clsx from 'clsx' import { forwardRef } from 'react' import type { ButtonHTMLAttributes, ForwardedRef } from 'react' import { Icon } from '../Icon' -import { VisuallyHidden } from '../VisuallyHidden' export type IconButtonProps = { /** The accessible text for the button. Will be announced by screen readers. Should describe the button’s action. */ @@ -36,7 +35,7 @@ export const IconButton = forwardRef( className, )} > - {label} + {label} ), diff --git a/packages/react/src/SearchField/SearchFieldButton.tsx b/packages/react/src/SearchField/SearchFieldButton.tsx index 27029eb727..e91ee9918a 100644 --- a/packages/react/src/SearchField/SearchFieldButton.tsx +++ b/packages/react/src/SearchField/SearchFieldButton.tsx @@ -8,7 +8,6 @@ import clsx from 'clsx' import { forwardRef } from 'react' import type { ForwardedRef, HTMLAttributes } from 'react' import { Icon } from '../Icon' -import { VisuallyHidden } from '../VisuallyHidden' type SearchFieldButtonProps = { /** Describes the field for screen readers. */ @@ -20,7 +19,7 @@ type SearchFieldButtonProps = { export const SearchFieldButton = forwardRef( ({ label = 'Zoeken', className, ...restProps }: SearchFieldButtonProps, ref: ForwardedRef) => ( ), diff --git a/packages/react/src/SearchField/SearchFieldInput.tsx b/packages/react/src/SearchField/SearchFieldInput.tsx index b52715d061..dc5c9618e5 100644 --- a/packages/react/src/SearchField/SearchFieldInput.tsx +++ b/packages/react/src/SearchField/SearchFieldInput.tsx @@ -6,7 +6,6 @@ import clsx from 'clsx' import { forwardRef, useId } from 'react' import type { ForwardedRef, InputHTMLAttributes } from 'react' -import { VisuallyHidden } from '../VisuallyHidden' type SearchFieldInputProps = { /** Whether the value fails a validation rule. */ @@ -24,8 +23,8 @@ export const SearchFieldInput = forwardRef( return ( <> -