Bug 476020 - Pressing Esc while having the tag autocomplete open closes the bookmarks panel, r=dietrich a191=beltzner
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 15 Apr 2009 22:24:43 +0200
changeset 24732 263032bde4faaa6311be676947688af373cacc03
parent 24731 df52eb41dbccfab29eec53458a1106bc6711bbc3
child 24733 98d20440f7807349ab26472026d82bb1c247ee94
push id1205
push usermak77@bonardo.net
push dateWed, 15 Apr 2009 20:25:28 +0000
reviewersdietrich
bugs476020
milestone1.9.1b4pre
Bug 476020 - Pressing Esc while having the tag autocomplete open closes the bookmarks panel, r=dietrich a191=beltzner
browser/base/content/browser-places.js
browser/components/places/tests/browser/browser_bookmarksProperties.js
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -108,22 +108,23 @@ var StarUI = {
           if (this._batching) {
             PlacesUIUtils.ptm.endBatch();
             this._batching = false;
           }
         }
         break;
       case "keypress":
         if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE) {
-          // In edit mode, if we're not editing a folder, the ESC key is mapped
-          // to the cancel button
+          // If the panel is visible the ESC key is mapped to the cancel button
+          // unless we are editing a folder in the folderTree, or an
+          // autocomplete popup is open.
           if (!this._element("editBookmarkPanelContent").hidden) {
             var elt = aEvent.target;
-            if (elt.localName != "tree" ||
-                (elt.localName == "tree" && !elt.hasAttribute("editing")))
+            if ((elt.localName != "tree" || !elt.hasAttribute("editing")) &&
+                !elt.popupOpen)
               this.cancelButtonOnCommand();
           }
         }
         else if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
           // hide the panel unless the folder tree is focused
           // or the tag autocomplete popup is open
           if (aEvent.target.localName != "tree" &&
               (aEvent.target.id != "editBMPanel_tagsField" ||
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -291,17 +291,17 @@ gTests.push({
     // Check that folder name has been changed.
     is(PlacesUtils.bookmarks.getItemTitle(this._itemId), "n",
        "Folder name has been edited");
 
     // Cleanup.
     PlacesUtils.bookmarks.removeItem(this._itemId);
   }
 });
-
+*/
 //------------------------------------------------------------------------------
 // Bug 476020 - Pressing Esc while having the tag autocomplete open closes the bookmarks panel
 
 gTests.push({
   desc: "Bug 476020 - Pressing Esc while having the tag autocomplete open closes the bookmarks panel",
   sidebar: SIDEBAR_BOOKMARKS_ID,
   action: ACTION_EDIT,
   itemType: null,
@@ -355,17 +355,17 @@ gTests.push({
     is(tags[0], "testTag", "Tag on node has not changed");
 
     // Cleanup.
     PlacesUtils.tagging.untagURI(PlacesUtils._uri(TEST_URL),
                                  ["testTag"]);
     PlacesUtils.bookmarks.removeItem(this._itemId);
   }
 });
-*/
+
 //------------------------------------------------------------------------------
 
 function test() {
   waitForExplicitFinish();
   // Sanity checks.
   ok(PlacesUtils, "PlacesUtils in context");
   ok(PlacesUIUtils, "PlacesUIUtils in context");