Bug 1333008 - Don't toggle play or pause when button is focused. r=jaws a=gchang
authorRay Lin <ralin@mozilla.com>
Thu, 16 Feb 2017 14:19:32 +0800
changeset 378635 27470afc80e8cbf7a2bb016acc03fc7451faec4d
parent 378634 8d0c434a75426db2555c7e226a1fa38d93940622
child 378636 55a727b432854f85e56f57ab2e73fd46c68238aa
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, gchang
bugs1333008
milestone53.0a2
Bug 1333008 - Don't toggle play or pause when button is focused. r=jaws a=gchang MozReview-Commit-ID: 2tyQUOOMQgH
toolkit/content/tests/widgets/test_videocontrols.html
toolkit/content/widgets/videocontrols.xml
--- 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 */