Skip to content

Commit bf976b4

Browse files
committed
Remove CSS modules feature flag from VisuallyHidden
1 parent 5cba52a commit bf976b4

File tree

3 files changed

+6
-71
lines changed

3 files changed

+6
-71
lines changed

packages/react/src/CounterLabel/__snapshots__/CounterLabel.test.tsx.snap

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`CounterLabel renders with secondary scheme when no "scheme" prop is provided 1`] = `
4-
.c0:not(:focus):not(:active):not(:focus-within) {
5-
-webkit-clip-path: inset(50%);
6-
clip-path: inset(50%);
7-
height: 1px;
8-
overflow: hidden;
9-
position: absolute;
10-
white-space: nowrap;
11-
width: 1px;
12-
}
13-
144
<div>
155
<span
166
aria-hidden="true"
@@ -20,7 +10,7 @@ exports[`CounterLabel renders with secondary scheme when no "scheme" prop is pro
2010
1234
2111
</span>
2212
<span
23-
class="c0"
13+
class="VisuallyHidden"
2414
>
2515
 (
2616
1234
@@ -30,16 +20,6 @@ exports[`CounterLabel renders with secondary scheme when no "scheme" prop is pro
3020
`;
3121

3222
exports[`CounterLabel respects the primary "scheme" prop 1`] = `
33-
.c0:not(:focus):not(:active):not(:focus-within) {
34-
-webkit-clip-path: inset(50%);
35-
clip-path: inset(50%);
36-
height: 1px;
37-
overflow: hidden;
38-
position: absolute;
39-
white-space: nowrap;
40-
width: 1px;
41-
}
42-
4323
<div>
4424
<span
4525
aria-hidden="true"
@@ -49,7 +29,7 @@ exports[`CounterLabel respects the primary "scheme" prop 1`] = `
4929
1234
5030
</span>
5131
<span
52-
class="c0"
32+
class="VisuallyHidden"
5333
>
5434
 (
5535
1234
Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,17 @@
1-
import styled from 'styled-components'
2-
import type {SxProp} from '../sx'
3-
import sx from '../sx'
4-
import {toggleStyledComponent} from '../internal/utils/toggleStyledComponent'
51
import {clsx} from 'clsx'
6-
import {useFeatureFlag} from '../FeatureFlags'
72
import React, {type HTMLAttributes} from 'react'
83
import classes from './VisuallyHidden.module.css'
94

10-
const CSS_MODULES_FEATURE_FLAG = 'primer_react_css_modules_ga'
11-
12-
/**
13-
* Provides a component that implements the "visually hidden" technique. This is
14-
* analagous to the common `sr-only` class. Children that are rendered inside
15-
* this component will not be visible but will be available to screen readers.
16-
*
17-
* Note: if this component, or a descendant, has focus then this component will
18-
* no longer be visually hidden.
19-
*
20-
* @see https://www.scottohara.me/blog/2023/03/21/visually-hidden-hack.html
21-
*/
22-
const StyledVisuallyHidden = toggleStyledComponent(
23-
CSS_MODULES_FEATURE_FLAG,
24-
'span',
25-
styled.span<SxProp>`
26-
&:not(:focus):not(:active):not(:focus-within) {
27-
clip-path: inset(50%);
28-
height: 1px;
29-
overflow: hidden;
30-
position: absolute;
31-
white-space: nowrap;
32-
width: 1px;
33-
}
34-
35-
${sx}
36-
`,
37-
)
38-
395
export const VisuallyHidden = ({className, children, ...rest}: VisuallyHiddenProps) => {
40-
const enabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
416
return (
42-
<StyledVisuallyHidden className={clsx(className, enabled && classes.VisuallyHidden)} {...rest}>
7+
<span className={clsx(className, classes.VisuallyHidden)} {...rest}>
438
{children}
44-
</StyledVisuallyHidden>
9+
</span>
4510
)
4611
}
4712

4813
export type VisuallyHiddenProps = React.PropsWithChildren<
4914
HTMLAttributes<HTMLSpanElement> & {
5015
className?: string
51-
} & SxProp
16+
}
5217
>

packages/react/src/__tests__/__snapshots__/Autocomplete.test.tsx.snap

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,6 @@ exports[`snapshots renders a loading state 1`] = `
537537
justify-content: center;
538538
}
539539
540-
.c3:not(:focus):not(:active):not(:focus-within) {
541-
-webkit-clip-path: inset(50%);
542-
clip-path: inset(50%);
543-
height: 1px;
544-
overflow: hidden;
545-
position: absolute;
546-
white-space: nowrap;
547-
width: 1px;
548-
}
549-
550540
.c2 {
551541
-webkit-animation: rotate-keyframes 1s linear infinite;
552542
animation: rotate-keyframes 1s linear infinite;
@@ -606,7 +596,7 @@ exports[`snapshots renders a loading state 1`] = `
606596
/>
607597
</svg>
608598
<span
609-
className="c3"
599+
className="VisuallyHidden"
610600
id=":r2h:"
611601
>
612602
Loading

0 commit comments

Comments
 (0)