Bug 1332280 - Disable flipping of the select dropdown if the dropdown has a search field. r?mconley draft
authorJared Wein <jwein@mozilla.com>
Thu, 19 Jan 2017 10:06:41 -0500
changeset 480059 0469977496431f80d62e49afa276a46e11d8c6eb
parent 479958 e677ba018b22558fef1d07b74d416fd3a28a5dc3
child 544866 503649813805355e231eb81ba8d394afbe7a1d0e
push id44448
push userbmo:jaws@mozilla.com
push dateTue, 07 Feb 2017 20:10:29 +0000
reviewersmconley
bugs1332280
milestone54.0a1
Bug 1332280 - Disable flipping of the select dropdown if the dropdown has a search field. r?mconley MozReview-Commit-ID: JWXoSf5CSXt
toolkit/modules/SelectParentHelper.jsm
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -41,30 +41,38 @@ this.SelectParentHelper = {
     selectRect = rect;
     this._registerListeners(browser, menulist.menupopup);
 
     let win = browser.ownerGlobal;
 
     // Set the maximum height to show exactly MAX_ROWS items.
     let menupopup = menulist.menupopup;
     let firstItem = menupopup.firstChild;
-    while (firstItem && firstItem.hidden) {
+    while (firstItem && firstItem.hidden &&
+           firstItem.localName != "textbox") {
       firstItem = firstItem.nextSibling;
     }
 
     if (firstItem) {
       let itemHeight = firstItem.getBoundingClientRect().height;
 
       // Include the padding and border on the popup.
       let cs = win.getComputedStyle(menupopup);
       let bpHeight = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth) +
                      parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
       menupopup.style.maxHeight = (itemHeight * MAX_ROWS + bpHeight) + "px";
     }
 
+    if (menupopup.firstChild &&
+        menupopup.firstChild.localName == "textbox") {
+      menupopup.setAttribute("flip", "none");
+    } else {
+      menupopup.removeAttribute("flip");
+    }
+
     menupopup.classList.toggle("isOpenedViaTouch", isOpenedViaTouch);
 
     let constraintRect = browser.getBoundingClientRect();
     constraintRect = new win.DOMRect(constraintRect.left + win.mozInnerScreenX,
                                      constraintRect.top + win.mozInnerScreenY,
                                      constraintRect.width, constraintRect.height);
     menupopup.setConstraintRect(constraintRect);
     menupopup.openPopupAtScreenRect(AppConstants.platform == "macosx" ? "selection" : "after_start", rect.left, rect.top, rect.width, rect.height, false, false);