Skip to content

Commit 391ad07

Browse files
authored
fix(a11y): add column headers to collections (#3809)
* fix column header: romove announcement * add table headers * add column definition API collections
1 parent bbb0e6c commit 391ad07

File tree

5 files changed

+45
-20
lines changed

5 files changed

+45
-20
lines changed

src/app/views/sidebar/resource-explorer/collection/APICollection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ const APICollection: React.FC<PopupsComponent<APICollection>> = (props) => {
7474
}
7575

7676
const columns = [
77-
{ key: 'url', name: '', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
78-
{ key: 'scope', name: '', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
77+
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
78+
{ key: 'scope', name: 'Scope', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
7979
];
8080

8181
const generateCollection = () => {

src/app/views/sidebar/resource-explorer/collection/EditCollectionPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const EditCollectionPanel: React.FC<EditCollectionPanelProps> = ({ closePopup })
2828
const items = collections && collections.length > 0 ? collections.find(k => k.isDefault)!.paths : [];
2929

3030
const columns = [
31-
{ key: 'url', name: 'Select all', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
32-
{ key: 'scope', name: '', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
31+
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
32+
{ key: 'scope', name: 'Scope', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
3333
];
3434

3535
const removeSelectedItems = () => {

src/app/views/sidebar/resource-explorer/collection/EditScopePanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ const EditScopePanel: React.FC<EditScopePanelProps> = ({ closePopup }) => {
5656
}, [selectedItems]);
5757

5858
const columns = [
59-
{ key: 'url', name: 'Select all', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
60-
{ key: 'scope', name: '', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
59+
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
60+
{ key: 'scope', name: 'Scope', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
6161
];
6262

6363
// eslint-disable-next-line @typescript-eslint/no-explicit-any

src/app/views/sidebar/resource-explorer/collection/Paths.tsx

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ import { handleShiftArrowSelection } from '../resourcelink.utils';
2323

2424
interface IPathProps {
2525
resources: ResourcePath[];
26-
columns: { key: string, name: string, fieldName: string, minWidth: number, maxWidth: number, isResizable: boolean }[];
26+
columns: {
27+
key: string;
28+
name: string;
29+
fieldName: string;
30+
minWidth: number;
31+
maxWidth: number;
32+
isResizable: boolean;
33+
}[];
2734
isSelectable?: boolean;
2835
onSelectionChange?: (selectedItems: ResourcePath[]) => void;
2936
}
@@ -61,7 +68,14 @@ const Paths: React.FC<IPathProps> = ({ resources, columns, isSelectable, onSelec
6168

6269
const renderItemColumn = (
6370
item: ResourcePath,
64-
column: { key: string, name: string, fieldName: string, minWidth: number, maxWidth: number, isResizable: boolean }
71+
column: {
72+
key: string;
73+
name: string;
74+
fieldName: string;
75+
minWidth: number;
76+
maxWidth: number;
77+
isResizable: boolean;
78+
}
6579
) => {
6680
if (column.key === 'scope') {
6781
return (
@@ -95,24 +109,34 @@ const Paths: React.FC<IPathProps> = ({ resources, columns, isSelectable, onSelec
95109
<TableHeader>
96110
<TableRow>
97111
{isSelectable && (
98-
<TableHeaderCell id='select-all-header' aria-label={translateMessage('Select all')} aria-live='polite'>
99-
<Checkbox
100-
aria-labelledby='select-all-header'
101-
checked={allSelected}
102-
onChange={handleSelectAllChange}
103-
onKeyDown={(e: React.KeyboardEvent) => {
104-
if (e.key === 'Enter') {
105-
handleSelectAllChange();
106-
}
107-
}}
108-
/>
112+
<TableHeaderCell
113+
aria-label={translateMessage('Select collection queries')}
114+
aria-live='polite'
115+
>
116+
<Tooltip
117+
content={translateMessage('Select all')}
118+
relationship="label"
119+
withArrow
120+
>
121+
<Checkbox
122+
aria-label={translateMessage('Select all')}
123+
aria-live='polite'
124+
checked={allSelected}
125+
onChange={handleSelectAllChange}
126+
onKeyDown={(e: React.KeyboardEvent) => {
127+
if (e.key === 'Enter') {
128+
handleSelectAllChange();
129+
}
130+
}}
131+
/>
132+
</Tooltip>
109133
</TableHeaderCell>
110134
)}
111135
{columns.map((column) => (
112136
<TableHeaderCell
113137
className={styles.tableHeader}
114138
key={column.key}
115-
aria-label={column.name}
139+
aria-label={translateMessage(column.key)}
116140
aria-live='polite'
117141
>
118142
{column.name}

src/messages/GE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@
392392
"Path display": "Path display",
393393
"More path links": "More path links",
394394
"Resources available": "Resources available",
395+
"Select collection queries": "Select collection queries",
395396
"Selected Resources": "Selected Resources",
396397
"A documentation link for this URL exists. Click learn more to access it": "A documentation link for this URL exists. Click here to access it",
397398
"Feedback": "Help Improve Graph Explorer?",

0 commit comments

Comments
 (0)