Skip to content

Commit

Permalink
[Accessibility] Loading indicator aria labels (#166391)
Browse files Browse the repository at this point in the history
## Summary

Closes #153597
In full screen, the loading indicator fails a11y tests. By removing the
aria-label and aria-hidden attributes, this allows the validation to
pass.
#153597 (comment)

This PR also introduces optional props for max and value props on the
`EuiProgress` component to provide consumers of the component greater
ability to define how the component is being used.
[Information](https://eui.elastic.co/#/display/progress#progress-with-values)
on the max and value props can be found in the [EUI
docs](https://eui.elastic.co/#/display/progress#progress-with-values).

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
rshen91 and kibanamachine authored Sep 28, 2023
1 parent 05a7d30 commit 424dec6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface LoadingIndicatorProps {
loadingCount$: ReturnType<HttpStart['getLoadingCount$']>;
showAsBar?: boolean;
customLogo?: string;
maxAmount?: number;
valueAmount?: string | number;
}

export class LoadingIndicator extends React.Component<LoadingIndicatorProps, { visible: boolean }> {
Expand Down Expand Up @@ -62,8 +64,6 @@ export class LoadingIndicator extends React.Component<LoadingIndicatorProps, { v
? 'globalLoadingIndicator'
: 'globalLoadingIndicator-hidden';

const ariaHidden = !this.state.visible;

const ariaLabel = i18n.translate('core.ui.loadingIndicatorAriaLabel', {
defaultMessage: 'Loading content',
});
Expand Down Expand Up @@ -107,8 +107,8 @@ export class LoadingIndicator extends React.Component<LoadingIndicatorProps, { v
<EuiProgress
className={className}
data-test-subj={testSubj}
aria-hidden={ariaHidden}
aria-label={ariaLabel}
max={this.props.maxAmount}
value={this.props.valueAmount}
position="fixed"
color="accent"
size="xs"
Expand Down

0 comments on commit 424dec6

Please sign in to comment.