Enhance accessibility and focus styles for Notification Console component

This commit is contained in:
Satyapriya Bai 2025-02-28 14:56:01 +05:30
parent 14c9874e5e
commit eb69ad13aa
4 changed files with 18 additions and 24 deletions

View File

@ -248,6 +248,10 @@
outline: 1px dashed @FocusColor; outline: 1px dashed @FocusColor;
} }
.focusedBorder() {
border: 1px dashed @FocusColor;
}
/************************************************************************************************ /************************************************************************************************
Common Toggle Switch Common Toggle Switch
*************************************************************************************************/ *************************************************************************************************/

View File

@ -36,6 +36,10 @@
&:active { &:active {
background-color:@NotificationHigh; background-color:@NotificationHigh;
} }
&:focus {
.focusedBorder();
}
.statusBar { .statusBar {
.dataTypeIcons { .dataTypeIcons {

View File

@ -81,10 +81,6 @@ export class NotificationConsoleComponent extends React.Component<
} }
} }
public setElememntRef = (element: HTMLElement): void => {
this.consoleHeaderElement = element;
};
public render(): JSX.Element { public render(): JSX.Element {
const numInProgress = this.state.allConsoleData.filter( const numInProgress = this.state.allConsoleData.filter(
(data: ConsoleData) => data.type === ConsoleDataType.InProgress, (data: ConsoleData) => data.type === ConsoleDataType.InProgress,
@ -101,7 +97,9 @@ export class NotificationConsoleComponent extends React.Component<
<div <div
className="notificationConsoleHeader" className="notificationConsoleHeader"
id="notificationConsoleHeader" id="notificationConsoleHeader"
ref={this.setElememntRef} role="button"
aria-label="Console"
aria-expanded={this.props.isConsoleExpanded}
onClick={() => this.expandCollapseConsole()} onClick={() => this.expandCollapseConsole()}
onKeyDown={(event: React.KeyboardEvent<HTMLDivElement>) => this.onExpandCollapseKeyPress(event)} onKeyDown={(event: React.KeyboardEvent<HTMLDivElement>) => this.onExpandCollapseKeyPress(event)}
tabIndex={0} tabIndex={0}
@ -129,14 +127,7 @@ export class NotificationConsoleComponent extends React.Component<
</span> </span>
</span> </span>
</div> </div>
<div <div className="expandCollapseButton" data-test="NotificationConsole/ExpandCollapseButton">
className="expandCollapseButton"
data-test="NotificationConsole/ExpandCollapseButton"
role="button"
tabIndex={0}
aria-label="Console"
aria-expanded={this.props.isConsoleExpanded}
>
<img <img
src={this.props.isConsoleExpanded ? ChevronDownIcon : ChevronUpIcon} src={this.props.isConsoleExpanded ? ChevronDownIcon : ChevronUpIcon}
alt={this.props.isConsoleExpanded ? "Collapse icon" : "Expand icon"} alt={this.props.isConsoleExpanded ? "Collapse icon" : "Expand icon"}
@ -259,9 +250,6 @@ export class NotificationConsoleComponent extends React.Component<
} }
private onConsoleWasExpanded = (): void => { private onConsoleWasExpanded = (): void => {
if (this.props.isConsoleExpanded && this.consoleHeaderElement) {
this.consoleHeaderElement.focus();
}
useNotificationConsole.getState().setConsoleAnimationFinished(true); useNotificationConsole.getState().setConsoleAnimationFinished(true);
}; };

View File

@ -5,10 +5,13 @@ exports[`NotificationConsoleComponent renders the console 1`] = `
className="notificationConsoleContainer" className="notificationConsoleContainer"
> >
<div <div
aria-expanded={false}
aria-label="Console"
className="notificationConsoleHeader" className="notificationConsoleHeader"
id="notificationConsoleHeader" id="notificationConsoleHeader"
onClick={[Function]} onClick={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
role="button"
tabIndex={0} tabIndex={0}
> >
<div <div
@ -71,12 +74,8 @@ exports[`NotificationConsoleComponent renders the console 1`] = `
</span> </span>
</div> </div>
<div <div
aria-expanded={false}
aria-label="Console"
className="expandCollapseButton" className="expandCollapseButton"
data-test="NotificationConsole/ExpandCollapseButton" data-test="NotificationConsole/ExpandCollapseButton"
role="button"
tabIndex={0}
> >
<img <img
alt="Expand icon" alt="Expand icon"
@ -176,10 +175,13 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
className="notificationConsoleContainer" className="notificationConsoleContainer"
> >
<div <div
aria-expanded={false}
aria-label="Console"
className="notificationConsoleHeader" className="notificationConsoleHeader"
id="notificationConsoleHeader" id="notificationConsoleHeader"
onClick={[Function]} onClick={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
role="button"
tabIndex={0} tabIndex={0}
> >
<div <div
@ -244,12 +246,8 @@ exports[`NotificationConsoleComponent renders the console 2`] = `
</span> </span>
</div> </div>
<div <div
aria-expanded={false}
aria-label="Console"
className="expandCollapseButton" className="expandCollapseButton"
data-test="NotificationConsole/ExpandCollapseButton" data-test="NotificationConsole/ExpandCollapseButton"
role="button"
tabIndex={0}
> >
<img <img
alt="Expand icon" alt="Expand icon"