Skip to content

Commit 94a6977

Browse files
committed
round play percentage to 2 decimal places.
1 parent ef6f193 commit 94a6977

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dotcom-rendering/src/components/LoopVideoProgressBar.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ type Props = {
3030
/**
3131
* A progress bar for the loop video component.
3232
*
33-
* Why don't we use the <progress /> element?
34-
* It was not possible to properly style the native progress element in safari.
33+
* Q. Why don't we use the <progress /> element?
34+
* A. It was not possible to properly style the native progress element in safari.
3535
*/
3636
export const LoopVideoProgressBar = ({
3737
videoId,
@@ -44,17 +44,18 @@ export const LoopVideoProgressBar = ({
4444
if (Number.isNaN(progressPercentage)) {
4545
return null;
4646
}
47+
const roundedProgressPercentage = Number(progressPercentage.toFixed(2));
4748

4849
return (
4950
<div
5051
role="progressbar"
5152
aria-labelledby={videoId}
52-
aria-valuenow={progressPercentage}
53+
aria-valuenow={roundedProgressPercentage}
5354
aria-valuemin={0}
5455
aria-valuemax={100}
5556
css={styles}
5657
>
57-
<span css={foregroundStyles(progressPercentage)} />
58+
<span css={foregroundStyles(roundedProgressPercentage)} />
5859
</div>
5960
);
6061
};

0 commit comments

Comments
 (0)