diff --git a/.changeset/late-wombats-cheer.md b/.changeset/late-wombats-cheer.md new file mode 100644 index 0000000000..cf3f8a0d2b --- /dev/null +++ b/.changeset/late-wombats-cheer.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: ensure value is correctly set to zero on the progress element diff --git a/packages/svelte/src/internal/client/dom/elements/attributes.js b/packages/svelte/src/internal/client/dom/elements/attributes.js index b05dd8f9aa..30c7712f1e 100644 --- a/packages/svelte/src/internal/client/dom/elements/attributes.js +++ b/packages/svelte/src/internal/client/dom/elements/attributes.js @@ -54,8 +54,13 @@ export function remove_input_defaults(input) { export function set_value(element, value) { // @ts-expect-error var attributes = (element.__attributes ??= {}); - // @ts-expect-error - if (attributes.value === (attributes.value = value) || element.value === value) return; + if ( + attributes.value === (attributes.value = value) || + // @ts-expect-error + // `progress` elements always need their value set when its `0` + (element.value === value && (value !== 0 || element.nodeName !== 'PROGRESS')) + ) + return; // @ts-expect-error element.value = value; }