Bug 517819, inherit noinitialfocus into textbox inputs, so that uthe nknown content dialog can use it, prevents focus from appearing on the file type field, r=neil

This commit is contained in:
Neil Deakin 2009-10-16 10:32:02 -04:00
parent d3b33d9c48
commit c67caab3df
4 changed files with 14 additions and 4 deletions

View File

@ -15,6 +15,8 @@
</tabpanels>
</tabbox>
<textbox id="textbox-yes" value="textbox-yes" hidden="true"/>
<textbox id="textbox-no" value="textbox-no" noinitialfocus="true" hidden="true"/>
<button id="one" label="One"/>
<button id="two" label="Two" hidden="true"/>
@ -41,6 +43,12 @@ function loaded()
two.hidden = false;
two.focus();
break;
case 8:
document.getElementById("textbox-yes").hidden = false;
break;
case 9:
document.getElementById("textbox-no").hidden = false;
break;
}
}
}

View File

@ -27,7 +27,7 @@
SimpleTest.waitForExplicitFinish();
var expected = [ "one", "_extra2", "tab", "one", "tabbutton2", "tabbutton", "two" ];
var expected = [ "one", "_extra2", "tab", "one", "tabbutton2", "tabbutton", "two", "textbox-yes", "one" ];
// non-Mac will always focus the default button if any of the dialog buttons
// would be focused
if (navigator.platform.indexOf("Mac") == -1)
@ -64,7 +64,9 @@ function runTest()
if (!(event.target instanceof Element))
return;
if (expectedFocus[0] == "_")
if (expectedFocus == "textbox-yes")
match = (win.document.activeElement == win.document.getElementById(expectedFocus).inputField);
else if (expectedFocus[0] == "_")
match = (win.document.activeElement.dlgType == expectedFocus.substring(1));
else
match = (win.document.activeElement.id == expectedFocus);

View File

@ -21,7 +21,7 @@
<children/>
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context,spellcheck">
<html:input class="textbox-input" flex="1" anonid="input"
xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,tabindex,accesskey"/>
xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,tabindex,accesskey,noinitialfocus"/>
</xul:hbox>
</content>

View File

@ -78,7 +78,7 @@
<separator class="thin"/>
<hbox align="center">
<label value="&whichIsA.label;" id="whichIsA"/>
<textbox id="type" class="plain" readonly="true" flex="1"/>
<textbox id="type" class="plain" readonly="true" flex="1" noinitialfocus="true"/>
</hbox>
<hbox align="center">
<label value="&from.label;" id="from"/>