Bug 1305282 - Make the SPACE key work for incremental search of options again. r=enndeakin, a=ritu
authorMats Palmgren <mats@mozilla.com>
Tue, 04 Oct 2016 21:13:53 +0200
changeset 350580 4f4a7d3bf772f34c1b5a3f3cc722c529763dd77c
parent 350579 0ddf1476b34c2dbb6189556ac58810b657ece971
child 350581 d567c767741298d727a5edc8aa1784f8d8e2b6f1
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, ritu
bugs1305282
milestone50.0
Bug 1305282 - Make the SPACE key work for incremental search of options again. r=enndeakin, a=ritu
layout/forms/nsListControlFrame.cpp
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -2133,19 +2133,22 @@ nsListControlFrame::KeyDown(nsIDOMEvent*
 #ifdef XP_MACOSX
   dropDownMenuOnUpDown = IsInDropDownMode() && !mComboboxFrame->IsDroppedDown();
   dropDownMenuOnSpace = !keyEvent->IsAlt() && !keyEvent->IsControl() &&
     !keyEvent->IsMeta();
 #else
   dropDownMenuOnUpDown = keyEvent->IsAlt();
   dropDownMenuOnSpace = IsInDropDownMode() && !mComboboxFrame->IsDroppedDown();
 #endif
+  bool withinIncrementalSearchTime =
+    keyEvent->mTime - gLastKeyTime <= INCREMENTAL_SEARCH_KEYPRESS_TIME;
   if ((dropDownMenuOnUpDown &&
        (keyEvent->mKeyCode == NS_VK_UP || keyEvent->mKeyCode == NS_VK_DOWN)) ||
-      (dropDownMenuOnSpace && keyEvent->mKeyCode == NS_VK_SPACE)) {
+      (dropDownMenuOnSpace && keyEvent->mKeyCode == NS_VK_SPACE &&
+       !withinIncrementalSearchTime)) {
     DropDownToggleKey(aKeyEvent);
     if (keyEvent->DefaultPrevented()) {
       return NS_OK;
     }
   }
   if (keyEvent->IsAlt()) {
     return NS_OK;
   }