Bug 1333008 - Don't toggle play or pause when button is focused. r=jaws
MozReview-Commit-ID: 2tyQUOOMQgH
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -368,20 +368,38 @@ function runTest(event) {
});
break;
case 26:
is(event.type, "volumechange", "checking event type");
is(video.volume, 0.5, "Volume should be decreased by 0.1");
SimpleTest.executeSoon(function() {
isVolumeSliderShowingCorrectVolume(video.volume);
+ synthesizeMouse(video, playButtonCenterX, playButtonCenterY, { });
+ });
+ break;
+
+ case 27:
+ is(event.type, "play", "checking event type");
+
+ SimpleTest.executeSoon(() => {
+ synthesizeKey(" ", {});
+ });
+ break;
+
+ case 28:
+ is(event.type, "pause", "checking event type");
+
+ SimpleTest.executeSoon(() => {
SimpleTest.finish();
});
break;
+
+
default:
throw "unexpected test #" + testnum + " w/ event " + event.type;
}
testnum++;
}
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1348,16 +1348,21 @@
}
this.log("Got keystroke: " + keystroke);
var oldval, newval;
try {
switch (keystroke) {
case "space": /* Play */
+ let target = event.originalTarget;
+ if (target.localName === "button" && !target.disabled) {
+ break;
+ }
+
this.togglePause();
break;
case "downArrow": /* Volume decrease */
oldval = this.video.volume;
this.video.volume = (oldval < 0.1 ? 0 : oldval - 0.1);
this.video.muted = false;
break;
case "upArrow": /* Volume increase */