Skip to content
Advertisement

Why `muted` attribute on video tag is ignored in React?

Well, as counter-intuitive as it sounds, muted tag is somehow ignored; check out the snippet below, first one is rendered with react, the second one regular html; inspect them with your dev tools, and you see the react on doesn’t have muted attribute; I already tried muted={true}, muted="true" but non is working.

JavaScript
JavaScript

Advertisement

Answer

This is actually a known issue which has existed since 2016. The video will be muted correctly, but the property will not be set in the DOM. You can find multiple workarounds in the GitHub issue, although there might be pros and cons with any of them.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement