Skip to content

Commit e0283b8

Browse files
vibdevanicholls
authored andcommitted
fix(common): Port accessible hide styles from JS to CSS (Workday#310)
* fix(common): Ports accessible hide code from js to css Code to make text screen reader only was added to js common but was not mirrored in the css. This adds a new class to the common css * Update readme * Change word-wrap: normal to white-space: nowrap * make accessible-hide available by mixin
1 parent b5ffc29 commit e0283b8

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Diff for: modules/common/css/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ or
3838

3939
## Forms
4040

41-
`forms` has shared styles for inputs
41+
`forms` has shared styles for inputs.
42+
43+
## Accessibility
44+
45+
`accessibility` has focus for inputs and method to provide screen reader only content.

Diff for: modules/common/css/lib/accessibility.scss

+17
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,20 @@
2121
outline: none;
2222
}
2323
}
24+
25+
@mixin wdc-accessible-hide() {
26+
clip: 'rect(1px, 1px, 1px, 1px)'; // Deprecated but still used by most browsers, clip-path will be taking its place soon.
27+
clip-path: 'polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px)';
28+
position: 'absolute';
29+
overflow: 'hidden';
30+
white-space: 'nowrap';
31+
height: '1px';
32+
width: '1px';
33+
margin: '-1px';
34+
padding: 0;
35+
border: 0;
36+
}
37+
38+
.wdc-accessible-hide {
39+
@include wdc-accessible-hide();
40+
}

Diff for: modules/common/react/lib/styles/accessibleHide.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const accessibleHide: CSSObject = {
99
clipPath: 'polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px)',
1010
position: 'absolute',
1111
overflow: 'hidden',
12-
wordWrap: 'normal',
12+
whiteSpace: 'nowrap',
1313
height: '1px',
1414
width: '1px',
1515
margin: '-1px',

0 commit comments

Comments
 (0)