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 355977 d98a2c44e2f7777150ed1fe51d4ad710afbb7712
parent 355976 911144fca18d8026ed73631ae2eeec07a9019f47
child 355978 7a8489d5e1e739e9e55d005616c82bafb1204903
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, ritu
bugs1305282
milestone51.0a2
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
@@ -2134,19 +2134,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;
   }