# All files / src/progress getProgressA11y.ts

100% Statements 25/25
100% Branches 3/3
100% Functions 1/1
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    261x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    3x
    3x
    3x
    3x
    2x
    2x
    1x
    1x
    1x
    1x
    1x
    1x
     export interface ProgressA11y {
      "aria-busy": true;
      "aria-describedby": string;
    }

    /**
     * An extremely simple util that can be used to get the required a11y props for
     * another component that relies on a progress component.
     *
     * @param progressId - The id for the progress bar
     * @param progressing - Boolean if the progress bar is visible and progressing
     */
    export function getProgressA11y(
      progressId: string,
      progressing: boolean
    ): ProgressA11y | undefined {
      if (!progressing) {
        return undefined;
      }

      return {
        "aria-busy": true,
        "aria-describedby": progressId,
      };
    }