Skip to content

Commit 77dd376

Browse files
Add content to table header for screen readers
1 parent 369258d commit 77dd376

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { styled } from "styled-components";
2+
3+
/**
4+
* An element that will be hidden from sighted users, but visible to screen readers.
5+
*/
6+
export const ScreenReaderOnly = styled.div`
7+
position: absolute;
8+
left: -10000px;
9+
top: auto;
10+
width: 1px;
11+
height: 1px;
12+
overflow: hidden;
13+
`;

extensions/ql-vscode/src/view/model-editor/ModeledMethodDataGrid.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { sortMethods } from "../../model-editor/shared/sorting";
1212
import { InProgressMethods } from "../../model-editor/shared/in-progress-methods";
1313
import { HiddenMethodsRow } from "./HiddenMethodsRow";
1414
import { ModelEditorViewState } from "../../model-editor/shared/view-state";
15+
import { ScreenReaderOnly } from "../common/ScreenReaderOnly";
1516

1617
export const SINGLE_MODEL_GRID_TEMPLATE_COLUMNS =
1718
"0.5fr 0.125fr 0.125fr 0.125fr 0.125fr";
@@ -92,7 +93,9 @@ export const ModeledMethodDataGrid = ({
9293
Kind
9394
</VSCodeDataGridCell>
9495
{viewState.showMultipleModels && (
95-
<VSCodeDataGridCell cellType="columnheader" gridColumn={6} />
96+
<VSCodeDataGridCell cellType="columnheader" gridColumn={6}>
97+
<ScreenReaderOnly>Add or remove models</ScreenReaderOnly>
98+
</VSCodeDataGridCell>
9699
)}
97100
</VSCodeDataGridRow>
98101
{methodsWithModelability.map(({ method, methodCanBeModeled }) => {

0 commit comments

Comments
 (0)