Bug 1123771 - don't expose search icon as button if all it does is focus input and label it otherwise, r=Mossop

This commit is contained in:
Gijs Kruitbosch 2015-02-06 11:44:37 +00:00
parent e6349b900e
commit 8ac6161641
5 changed files with 27 additions and 8 deletions

View File

@ -40,6 +40,15 @@
//////////////////////////////////////////////////////////////////////////
// search textbox
accTree =
{ SECTION: [
{ ENTRY: [ { TEXT_LEAF: [] } ] },
{ MENUPOPUP: [] }
] };
testAccessibleTree("txc_search", accTree);
//////////////////////////////////////////////////////////////////////////
// search textbox with search button
if (MAC) {
accTree =
@ -56,7 +65,7 @@
] };
}
testAccessibleTree("txc_search", accTree);
testAccessibleTree("txc_search_searchbutton", accTree);
//////////////////////////////////////////////////////////////////////////
// number textbox
@ -195,6 +204,7 @@
<vbox flex="1">
<textbox id="txc" value="hello"/>
<textbox id="txc_search" type="search" value="hello"/>
<textbox id="txc_search_searchbutton" searchbutton="true" type="search" value="hello"/>
<textbox id="txc_number" type="number" value="44"/>
<textbox id="txc_password" type="password" value="hello"/>
<textbox id="txc_multiline" multiline="true" value="hello"/>

View File

@ -319,11 +319,11 @@
<html:input class="textbox-input" anonid="input" mozactionhint="search"
xbl:inherits="value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey,mozactionhint,spellcheck"/>
<xul:deck class="textbox-search-icons" anonid="search-icons">
<xul:image class="textbox-search-icon"
onclick="document.getBindingParent(this)._iconClick();"
xbl:inherits="src=image,searchbutton,disabled"/>
<xul:image class="textbox-search-icon" anonid="searchbutton-icon"
xbl:inherits="src=image,label=searchbuttonlabel,searchbutton,disabled"/>
<xul:image class="textbox-search-clear"
onclick="document.getBindingParent(this)._clearSearch();"
label="&searchTextBox.clear.label;"
xbl:inherits="disabled"/>
</xul:deck>
</xul:hbox>
@ -333,6 +333,9 @@
<field name="_searchIcons">
document.getAnonymousElementByAttribute(this, "anonid", "search-icons");
</field>
<field name="_searchButtonIcon">
document.getAnonymousElementByAttribute(this, "anonid", "searchbutton-icon");
</field>
<property name="timeout"
onset="this.setAttribute('timeout', val); return val;"
onget="return parseInt(this.getAttribute('timeout')) || 500;"/>
@ -342,8 +345,11 @@
if (val) {
this.setAttribute("searchbutton", "true");
this.removeAttribute("aria-autocomplete");
// Hack for the button to get the right accessible:
this._searchButtonIcon.setAttribute("onclick", "true");
} else {
this.removeAttribute("searchbutton");
this._searchButtonIcon.removeAttribute("onclick");
this.setAttribute("aria-autocomplete", "list");
}
return val;
@ -366,10 +372,9 @@
]]></setter>
</property>
<constructor><![CDATA[
if (this.searchButton)
this.removeAttribute("aria-autocomplete");
else
this.setAttribute("aria-autocomplete", "list");
// Ensure the button state is up to date:
this.searchButton = this.searchButton;
this._searchButtonIcon.addEventListener("click", (e) => this._iconClick(e), false);
]]></constructor>
<method name="_fireCommand">
<parameter name="me"/>

View File

@ -24,3 +24,5 @@
<!ENTITY spellNoSuggestions.label "(No Spelling Suggestions)">
<!ENTITY spellDictionaries.label "Languages">
<!ENTITY spellDictionaries.accesskey "l">
<!ENTITY searchTextBox.clear.label "Clear">

View File

@ -4,6 +4,7 @@
<!ENTITY addons.windowTitle "Add-ons Manager">
<!ENTITY search.placeholder "Search all add-ons">
<!ENTITY search.buttonlabel "Search">
<!-- LOCALIZATION NOTE (search.commandKey):
The search command key should match findOnCmd.commandkey from browser.dtd -->
<!ENTITY search.commandkey "f">

View File

@ -177,6 +177,7 @@
</menupopup>
</toolbarbutton>
<textbox id="header-search" type="search" searchbutton="true"
searchbuttonlabel="&search.buttonlabel;"
placeholder="&search.placeholder;"/>
</hbox>