preventDefault does not prevent spacebar on video
selimb opened this issue · 0 comments
selimb commented
I noticed that event.preventDefault()
does not prevent the player from switching state when I press spacebar "on" the video.
In other words, if I have a responder that merely does the following:
a = document.getElementsByTagName("body")[0];
responder = function (evt) {
evt.preventDefault();
console.log(evt.cancelable);
};
a.onkeydown = responder;
and I put focus on the youtube video and press on the spacebar, the video is still paused/played. However, console tells me that the event is cancelable.
The consequence of this is that pressing spacebar with the extension enabled performs a "double-toggle".
Does anyone know why this happens? The dirty solution would be to not do anything if the event.target
is the media player.