svelte icon indicating copy to clipboard operation
svelte copied to clipboard

fix: ensure muted DOM property works correctly in FF

Open trueadm opened this issue 1 year ago • 4 comments

Fixes 1) of https://github.com/sveltejs/svelte/issues/13700. This makes it work like autofocus where we set it as a property after creating the element.

trueadm avatar Oct 21 '24 16:10 trueadm

🦋 Changeset detected

Latest commit: cacd1f12224bd871f553cfd7fb8e51ff19e4c5f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 21 '24 16:10 changeset-bot[bot]

I think this isn't the right fix - the problem exists for some other attributes, too (for example <video playsinline></video> is also set as a property in Svelte 4). I believe this hints at a bug deeper down - that attributes aren't consistently set as properties. For example if you do <audio muted={true}></audio> - which should be equivalent to <audio muted></audio> - then you'll have it set as a property. The question is for which attributes this makes a difference - if it's only muted or more. If it's only muted then this may be correct after all, though I think a function is overkill, we can just output node.muted = ... into the generated code directly.

dummdidumm avatar Oct 22 '24 11:10 dummdidumm

playsinline seems to work fine for me. @michelheusschen Do you know of any other attributes that don't work for you in FF?

If it's only muted then this may be correct after all, though I think a function is overkill, we can just output node.muted = ... into the generated code directly.

Good point, change made.

trueadm avatar Oct 22 '24 11:10 trueadm

I'm not aware of any other properties besides muted. The playsinline attribute works fine for me in chrome and is unsupported in firefox: https://caniuse.com/mdn-html_elements_video_playsinline

michelheusschen avatar Oct 22 '24 12:10 michelheusschen