Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Remove Visually Hidden component #1391

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/css/src/components/visually-hidden/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@

Hides content from sighted users but keeps it accessible to non-visual user agents, such as screen readers.

Note: in most cases, visually available content should be accessible to non-visual user agents and vice versa.
Elaborate instructions or guidance read only by non-visual user agents can do more harm than good.
## Guidelines

- In most cases, visually available content should be accessible to non-visual user agents and vice versa.
- Elaborate instructions or guidance read only by non-visual user agents can do more harm than good.
2 changes: 1 addition & 1 deletion packages/react/documentation/coding-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Subcomponents (e.g. `Grid.Cell`) are kept in separate files (e.g. `GridCell.tsx`

## Text for screen readers only

Use [Visually Hidden](https://designsystem.amsterdam/?path=/docs/components-containers-visually-hidden--docs) or the `ams-visually-hidden` utility class to hide content from sighted users but keep it accessible to non-visual user agents, such as screen readers.
Use the `ams-visually-hidden` [utility class](http://designsystem.amsterdam/?path=/docs/utilities-css-visually-hidden--docs) to hide content from sighted users but keep it accessible to non-visual user agents, such as screen readers.

Do not use `aria-label`. Tools for automatic translation often [do not translate its value](https://adrianroselli.com/2019/11/aria-label-does-not-translate.html), and it may get overlooked when doing manual translation.
dlnr marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
5 changes: 0 additions & 5 deletions packages/react/src/VisuallyHidden/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions packages/react/src/VisuallyHidden/VisuallyHidden.test.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions packages/react/src/VisuallyHidden/VisuallyHidden.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/src/VisuallyHidden/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export * from './Spotlight'
export * from './Card'
export * from './Alert'
export * from './AspectRatio'
export * from './VisuallyHidden'
export * from './Footer'
export * from './PageMenu'
export * from './TopTaskLink'
Expand Down
1 change: 1 addition & 0 deletions storybook/config/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const parameters = {
'Foundation',
'Components',
['Buttons', 'Containers', 'Feedback', 'Forms', 'Layout', 'Media', 'Navigation', 'Text'],
'Utilities',
'Pages',
['Introduction', 'Amsterdam.nl', ['Home Page']],
],
Expand Down
40 changes: 0 additions & 40 deletions storybook/src/components/VisuallyHidden/VisuallyHidden.stories.tsx

This file was deleted.

44 changes: 44 additions & 0 deletions storybook/src/utils/VisuallyHidden/VisuallyHidden.stories.tsx
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @license EUPL-1.2+
* Copyright Gemeente Amsterdam
*/

import { Paragraph } from '@amsterdam/design-system-react'
import { Meta, StoryObj } from '@storybook/react'
import type { HTMLAttributes } from 'react'

type VisuallyHiddenProps = HTMLAttributes<HTMLSpanElement>

const VisuallyHidden = ({ children }: VisuallyHiddenProps) => <span className="ams-visually-hidden">{children}</span>
dlnr marked this conversation as resolved.
Show resolved Hide resolved

const render = ({ children }: VisuallyHiddenProps) => (
<div>
<Paragraph>
This paragraph is available for everyone. Below this is a second paragraph, but it is aimed at non-visual user
agents only. It is not perceivable on a screen.
</Paragraph>
<Paragraph className="ams-visually-hidden">{children}</Paragraph>
</div>
)

const meta = {
title: 'Utilities/CSS/Visually Hidden',
dlnr marked this conversation as resolved.
Show resolved Hide resolved
component: VisuallyHidden,
args: {
children: 'Here is the paragraph that is visually hidden. A screen reader will pick it up and read it to its user.',
},
argTypes: {
children: {
description: 'The content to hide visually.',
table: { disable: false },
},
},
} satisfies Meta<typeof VisuallyHidden>

export default meta

type Story = StoryObj<typeof meta>

export const Default: Story = {
render,
}