Skip to content

Commit ced2725

Browse files
satya07sbSatyapriya Bai
and
Satyapriya Bai
authored
Enhance accessibility and focus styles for Notification Console component (#2066)
Co-authored-by: Satyapriya Bai <[email protected]>
1 parent b5d7423 commit ced2725

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

less/Common/Constants.less

+4
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@
248248
outline: 1px dashed @FocusColor;
249249
}
250250

251+
.focusedBorder() {
252+
border: 1px dashed @FocusColor;
253+
}
254+
251255
/************************************************************************************************
252256
Common Toggle Switch
253257
*************************************************************************************************/

src/Explorer/Menus/NotificationConsole/NotificationConsole.less

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
&:active {
3737
background-color:@NotificationHigh;
3838
}
39+
40+
&:focus {
41+
.focusedBorder();
42+
}
3943

4044
.statusBar {
4145
.dataTypeIcons {

src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx

+4-16
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ export class NotificationConsoleComponent extends React.Component<
8181
}
8282
}
8383

84-
public setElememntRef = (element: HTMLElement): void => {
85-
this.consoleHeaderElement = element;
86-
};
87-
8884
public render(): JSX.Element {
8985
const numInProgress = this.state.allConsoleData.filter(
9086
(data: ConsoleData) => data.type === ConsoleDataType.InProgress,
@@ -101,7 +97,9 @@ export class NotificationConsoleComponent extends React.Component<
10197
<div
10298
className="notificationConsoleHeader"
10399
id="notificationConsoleHeader"
104-
ref={this.setElememntRef}
100+
role="button"
101+
aria-label="Console"
102+
aria-expanded={this.props.isConsoleExpanded}
105103
onClick={() => this.expandCollapseConsole()}
106104
onKeyDown={(event: React.KeyboardEvent<HTMLDivElement>) => this.onExpandCollapseKeyPress(event)}
107105
tabIndex={0}
@@ -129,14 +127,7 @@ export class NotificationConsoleComponent extends React.Component<
129127
</span>
130128
</span>
131129
</div>
132-
<div
133-
className="expandCollapseButton"
134-
data-test="NotificationConsole/ExpandCollapseButton"
135-
role="button"
136-
tabIndex={0}
137-
aria-label="Console"
138-
aria-expanded={this.props.isConsoleExpanded}
139-
>
130+
<div className="expandCollapseButton" data-test="NotificationConsole/ExpandCollapseButton">
140131
<img
141132
src={this.props.isConsoleExpanded ? ChevronDownIcon : ChevronUpIcon}
142133
alt={this.props.isConsoleExpanded ? "Collapse icon" : "Expand icon"}
@@ -259,9 +250,6 @@ export class NotificationConsoleComponent extends React.Component<
259250
}
260251

261252
private onConsoleWasExpanded = (): void => {
262-
if (this.props.isConsoleExpanded && this.consoleHeaderElement) {
263-
this.consoleHeaderElement.focus();
264-
}
265253
useNotificationConsole.getState().setConsoleAnimationFinished(true);
266254
};
267255

src/Explorer/Menus/NotificationConsole/__snapshots__/NotificationConsoleComponent.test.tsx.snap

+6-8
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ exports[`NotificationConsoleComponent renders the console 1`] = `
55
className="notificationConsoleContainer"
66
>
77
<div
8+
aria-expanded={false}
9+
aria-label="Console"
810
className="notificationConsoleHeader"
911
id="notificationConsoleHeader"
1012
onClick={[Function]}
1113
onKeyDown={[Function]}
14+
role="button"
1215
tabIndex={0}
1316
>
1417
<div
@@ -71,12 +74,8 @@ exports[`NotificationConsoleComponent renders the console 1`] = `
7174
</span>
7275
</div>
7376
<div
74-
aria-expanded={false}
75-
aria-label="Console"
7677
className="expandCollapseButton"
7778
data-test="NotificationConsole/ExpandCollapseButton"
78-
role="button"
79-
tabIndex={0}
8079
>
8180
<img
8281
alt="Expand icon"
@@ -176,10 +175,13 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
176175
className="notificationConsoleContainer"
177176
>
178177
<div
178+
aria-expanded={false}
179+
aria-label="Console"
179180
className="notificationConsoleHeader"
180181
id="notificationConsoleHeader"
181182
onClick={[Function]}
182183
onKeyDown={[Function]}
184+
role="button"
183185
tabIndex={0}
184186
>
185187
<div
@@ -244,12 +246,8 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
244246
</span>
245247
</div>
246248
<div
247-
aria-expanded={false}
248-
aria-label="Console"
249249
className="expandCollapseButton"
250250
data-test="NotificationConsole/ExpandCollapseButton"
251-
role="button"
252-
tabIndex={0}
253251
>
254252
<img
255253
alt="Expand icon"

0 commit comments

Comments
 (0)