Skip to content

Commit 29f518a

Browse files
authored
fix: progress bar when value is missing in firefox and safari (#34684)
1 parent 73cbd01 commit 29f518a

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix: progress bar when value is missing in firefox and safari",
4+
"packageName": "@fluentui/web-components",
5+
"email": "machi@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/web-components/src/progress-bar/progress-bar.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class BaseProgressBar extends FASTElement {
113113
return;
114114
}
115115

116-
if (Number.isNaN(this.value)) {
116+
if (typeof this.value !== 'number') {
117117
this.indicator.style.removeProperty('width');
118118
return;
119119
}

packages/web-components/src/progress-bar/progress-bar.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ test.describe('Progress Bar', () => {
4141
await expect(element).toHaveJSProperty('elementInternals.ariaValueMax', '50');
4242
});
4343

44+
test('should set indicator width to be 1/3 of the container width if `value` is missing', async ({ fastPage }) => {
45+
const { element } = fastPage;
46+
await element.evaluate(node => {
47+
node.style.setProperty('width', '100px');
48+
});
49+
const indicator = element.locator('.indicator');
50+
51+
await expect(indicator).toHaveCSS('width', '33px');
52+
});
53+
4454
test('should set indicator width to match the `value` property as a percentage between 0 and 100 when `min` and `max` are unset', async ({
4555
fastPage,
4656
}) => {

0 commit comments

Comments
 (0)