Bug 1017423 - Page is scrolled when I select radio button by up/down arrow key. r=Gijs
authorJared Wein <jwein@mozilla.com>
Mon, 02 Jun 2014 23:15:13 -0400
changeset 205491 4fdeddd516abdd172d87f66eda20800064f06779
parent 205490 6f0f4c8b968f6bc0e7dc831b9a6d347c5ed016e8
child 205492 fc14c1c42b68706536b2929f8021f1c00bc61e74
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1017423
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1017423 - Page is scrolled when I select radio button by up/down arrow key. r=Gijs
toolkit/content/widgets/radio.xml
--- a/toolkit/content/widgets/radio.xml
+++ b/toolkit/content/widgets/radio.xml
@@ -371,32 +371,36 @@
            takes you to the next widget in the tab order -->
       <handler event="keypress" key=" " phase="target">
          this.selectedItem = this.focusedItem;
          this.selectedItem.doCommand();
       </handler>
       <handler event="keypress" keycode="VK_UP" phase="target">
         this.checkAdjacentElement(false);
         event.stopPropagation();
+        event.preventDefault();
       </handler>
       <handler event="keypress" keycode="VK_LEFT" phase="target">
         // left arrow goes back when we are ltr, forward when we are rtl
         this.checkAdjacentElement(document.defaultView.getComputedStyle(
                                     this, "").direction == "rtl");
         event.stopPropagation();
+        event.preventDefault();
       </handler>
       <handler event="keypress" keycode="VK_DOWN" phase="target">
         this.checkAdjacentElement(true);
         event.stopPropagation();
+        event.preventDefault();
       </handler>
       <handler event="keypress" keycode="VK_RIGHT" phase="target">
         // right arrow goes forward when we are ltr, back when we are rtl
         this.checkAdjacentElement(document.defaultView.getComputedStyle(
                                     this, "").direction == "ltr");
         event.stopPropagation();
+        event.preventDefault();
       </handler>
 
       <!-- set a focused attribute on the selected item when the group
            receives focus so that we can style it as if it were focused even though
            it is not (Windows platform behaviour is for the group to receive focus,
            not the item -->
       <handler event="focus" phase="target">
         <![CDATA[