Commit 7067b0d9 authored by Dão Gottwald's avatar Dão Gottwald
Browse files

Bug 463635 - All Tabs search doesn't always update on Enter. r=gavin

parent 0284ad8e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -617,8 +617,12 @@ var ctrlTab = {
      case "keydown":
      case "keyup":
        if (event.target == this.searchField) {
          if (event.keyCode == event.DOM_VK_RETURN)
            this.panel.focus();
          if (event.keyCode == event.DOM_VK_RETURN) {
            // If there's a pending search, kick it off now.
            if (this.searchField._timer)
              this.search();
            this.selectThumbnail();
          }
        } else {
          // Manually consume the events, as the panel is open but doesn't
          // necessarily have focus.
+12 −1
Original line number Diff line number Diff line
@@ -91,7 +91,18 @@ function test() {
    ok(isOpen(),
       "panel is sticky after focusing the search field and releasing the Ctrl key");

    ctrlTab.searchField.value = "foo";
    EventUtils.synthesizeKey("f", {});
    EventUtils.synthesizeKey("o", {});
    EventUtils.synthesizeKey("o", {});
    is(ctrlTab.searchField.value, "foo",
       "text entered into search field");

    EventUtils.synthesizeKey("VK_RETURN", {});
    ok(isOpen(),
       "Enter key kicks pending search off; the panel stays open as there's no match");
    is(ctrlTab.searchField.value, "foo",
       "search field value persists after Enter pressed");

    EventUtils.synthesizeKey("VK_ESCAPE", {});
    is(ctrlTab.searchField.value, "",
       "ESC key clears the search field");