Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio: muted property not updating without bind:muted #15286

Closed
f1nzer opened this issue Feb 13, 2025 · 4 comments · Fixed by #15326
Closed

audio: muted property not updating without bind:muted #15286

f1nzer opened this issue Feb 13, 2025 · 4 comments · Fixed by #15326

Comments

@f1nzer
Copy link

f1nzer commented Feb 13, 2025

Describe the bug

Setting muted={muted} on <audio> in Svelte 5.20 does not update the property when muted changes, but bind:muted={muted} works as expected. But it worked in Svelte 4.

Expected behavior: clicking the button should toggle the muted property on the audio as it did in Svelte 4
Actual behavior: muted does not update unless using bind:muted={muted}

Reproduction

Svelte 5.20 playground

Svelte 4.2.19 playground

Logs

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 241.31 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.3.0 - /opt/homebrew/bin/node
    npm: 10.9.0 - /opt/homebrew/bin/npm
    pnpm: 10.3.0 - ~/Library/pnpm/pnpm
    bun: 1.1.21 - ~/.bun/bin/bun
  Browsers:
    Safari: 18.2

Chrome Version 132.0.6834.160 (Official Build) (arm64)

Severity

annoyance

@adiguba
Copy link
Contributor

adiguba commented Feb 13, 2025

Hello,

I think it's come from #13751 and theses lines :

// Special case for Firefox who needs it set as a property in order to work
if (name === 'muted') {
state.init.push(b.stmt(b.assignment('=', b.member(node_id, b.id('muted')), value)));
return false;
}

The code is added on the "init" state of the component, but since the variable is reactive, this should be done on the "update" state.
Strangely, if I delete these lines it seems to work fine...

@paoloricciuti
Copy link
Member

Hello,

I think it's come from #13751 and theses lines :

svelte/packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines 544 to 548 in 21dadfc

// Special case for Firefox who needs it set as a property in order to work
if (name === 'muted') {
state.init.push(b.stmt(b.assignment('=', b.member(node_id, b.id('muted')), value)));
return false;
}
The code is added on the "init" state of the component, but since the variable is reactive, this should be done on the "update" state. Strangely, if I delete these lines it seems to work fine...

Just stumbled across this while fixing the $0 bug...did you also test in Firefox?

@adiguba
Copy link
Contributor

adiguba commented Feb 17, 2025

I always use Firefox...

@paoloricciuti
Copy link
Member

I always use Firefox...

Mmm...weird...just for the sake of honoring the comment i'm gonna fix it while keep assigning to the property but definitely worth exploring if it's dead code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants