-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(VisuallyHidden): Convert VisuallyHidden to CSS module behind fea…
…ture flag (#5193) * Migrate VisuallyHidden to CSS Modules * lint fix * add storybook dev for flag testing
- Loading branch information
1 parent
573ae51
commit ed3d8c1
Showing
5 changed files
with
67 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Migrated `VisuallyHidden` to CSS Modules |
This file contains 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
15 changes: 15 additions & 0 deletions
15
packages/react/src/VisuallyHidden/VisuallyHidden.dev.stories.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import type {Meta} from '@storybook/react' | ||
import {VisuallyHidden} from './VisuallyHidden' | ||
|
||
export default { | ||
title: 'Components/VisuallyHidden/Dev', | ||
component: VisuallyHidden, | ||
} as Meta<typeof VisuallyHidden> | ||
|
||
export const Default = () => ( | ||
<div> | ||
<span>Visible Text</span> | ||
<VisuallyHidden>Visually Hidden Text</VisuallyHidden> | ||
</div> | ||
) |
10 changes: 10 additions & 0 deletions
10
packages/react/src/VisuallyHidden/VisuallyHidden.module.css
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.VisuallyHidden { | ||
&:not(:focus):not(:active):not(:focus-within) { | ||
position: absolute; | ||
width: 1px; | ||
height: 1px; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
clip-path: inset(50%); | ||
} | ||
} |
This file contains 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