Bug 592904 - "Hide the Form Assistant select UI filter box for small select lists" [r=mark.finkle]

This commit is contained in:
Wesley Johnston 2010-11-04 09:41:00 -04:00
parent d95e100c45
commit f292b387df
3 changed files with 25 additions and 4 deletions

View File

@ -2164,6 +2164,8 @@ var SelectHelperUI = {
},
show: function(aList) {
this.showFilter = false;
this._textbox.blur();
this._list = aList;
this._container = document.getElementById("select-list");
@ -2208,13 +2210,22 @@ var SelectHelperUI = {
this._scrollElementIntoView(firstSelected);
this._container.addEventListener("click", this, false);
this._panel.addEventListener("overflow", this, true);
},
_showFilter: false,
get showFilter() {
return this._showFilter;
},
set showFilter(val) {
this._showFilter = val;
if (!this._panel.hidden)
this._textbox.hidden = !val;
},
dock: function dock(aContainer) {
aContainer.insertBefore(this._panel, aContainer.lastChild);
this.resize();
this._textbox.hidden = false;
this._docked = true;
},
@ -2241,8 +2252,11 @@ var SelectHelperUI = {
},
hide: function() {
this.showFilter = false;
this._container.removeEventListener("click", this, false);
this._panel.hidden = this._textbox.hidden = true;
this._panel.removeEventListener("overflow", this, true);
this._panel.hidden = true;
if (this._docked)
this.undock();
@ -2369,6 +2383,10 @@ var SelectHelperUI = {
this.onSelect(item.optionIndex, item.selected, !this._list.multiple);
}
break;
case "overflow":
if (!this._textbox.value)
this.showFilter = true;
break;
}
},

View File

@ -292,7 +292,8 @@
<vbox id="content-navigator" class="window-width" top="0" spacer="content-navigator-spacer">
<arrowscrollbox id="form-helper-autofill" collapsed="true" align="center" flex="1" orient="horizontal"
onclick="FormHelperUI.doAutoComplete(event.target);"/>
<textbox id="select-helper-textbox" class="search-bar content-navigator-item" oncommand="SelectHelperUI.filter(this.value)" type="search" flex="1" hidden="true"/>
<textbox id="select-helper-textbox" class="search-bar content-navigator-item" oncommand="SelectHelperUI.filter(this.value)"
placeholder="&selectHelper.emptytext;" type="search" flex="1" hidden="true"/>
<textbox id="find-helper-textbox" class="search-bar content-navigator-item" oncommand="FindHelperUI.search(this.value)" oninput="FindHelperUI.updateCommands(this.value);" type="search" flex="1"/>
</vbox>
</stack>

View File

@ -106,3 +106,5 @@
<!ENTITY pageactions.reset "Clear Site Preferences">
<!ENTITY pageactions.findInPage "Find In Page">
<!ENTITY pageactions.search.addNew "Add Search Engine">
<!ENTITY selectHelper.emptytext "Filter List">