Skip to content

Commit

Permalink
fix(ADA-1742): When errors pops up they will also be announced by SR (#…
Browse files Browse the repository at this point in the history
…963)

Issue:
Errors are not announced by the SR in case they pop up

Fix:
Adding aria-live and role alert in case we have a type error overlay

Resolves: https://kaltura.atlassian.net/browse/ADA-1742
  • Loading branch information
RazvanBrinzoiK05 authored Dec 9, 2024
1 parent 71a97fc commit b18d8fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/overlay/overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ class Overlay extends Component<OverlayProps, any> {
* @memberof Overlay
*/
render({type, open, ariaLabel, ariaLabelledBy}: any): VNode<any> {
const ariaProps = ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {'aria-label': ariaLabel};
const role = type === 'error' ? 'alert' : 'dialog';
const ariaLive = type === 'error' ? 'polite' : undefined;
const ariaProps = ariaLabelledBy ? { 'aria-labelledby': ariaLabelledBy, 'aria-live': ariaLive } : { 'aria-label': ariaLabel, 'aria-live': ariaLive }
const overlayClass = [style.overlay];
if (type) {
const classType = style[type + '-overlay'] ? style[type + '-overlay'] : type + '-overlay';
Expand All @@ -187,7 +189,7 @@ class Overlay extends Component<OverlayProps, any> {
}

return (
<div tabIndex={-1} className={overlayClass.join(' ')} role="dialog" onKeyDown={this.onKeyDown} {...ariaProps}>
<div tabIndex={-1} className={overlayClass.join(' ')} role={role} onKeyDown={this.onKeyDown} {...ariaProps}>
<div className={style.overlayContents}>{this.props.children}</div>
{this.renderCloseButton(this.props)}
</div>
Expand Down

0 comments on commit b18d8fc

Please sign in to comment.