Reputation: 5016
When I add pointer-events:none; to video (just to temporarily disable controls), if focus is on play button, spacebar still triggers play.
is this intended behavior?
what would be the cleanest to prevent this? (possible without javascript?)
To replicate, on page load, click play video to get focus, wait few seconds for pointer-events then use spacebar.
setTimeout(function(){
document.getElementById('video').classList.add('disabled')
},4000)
.disabled{
pointer-events:none;
}
<video controls id="video">
<source src="http://media.w3.org/2010/05/sintel/trailer.mp4">
</video>
Upvotes: 0
Views: 47
Reputation: 61
What comes to my mind is also removing controls when disabling the video:
document.getElementById("video").attributes.removeNamedItem("controls");
Upvotes: 1