Bug 303928: Tabbing or arrowing off autocomplete closes selection and location shows last selected entry, patch by Simon B�nzli <zeniko@gmail.com>, r=mconnor

This commit is contained in:
gavin%gavinsharp.com 2005-09-17 01:12:22 +00:00
parent 6bcd26663d
commit ff647353fe

View File

@ -462,6 +462,14 @@
]]></body> ]]></body>
</method> </method>
<method name="_focus"> <!-- doesn't reset this.mController -->
<body><![CDATA[
this._dontBlur = true;
this.focus();
this._dontBlur = false;
]]></body>
</method>
</implementation> </implementation>
<handlers> <handlers>
@ -481,7 +489,7 @@
action="this.attachController();"/> action="this.attachController();"/>
<handler event="blur" phase="capturing" <handler event="blur" phase="capturing"
action="this.detachController();"/> action="if (!this._dontBlur) this.detachController();"/>
</handlers> </handlers>
</binding> </binding>
@ -582,12 +590,9 @@
<body><![CDATA[ <body><![CDATA[
try { try {
var amount = aPage ? 5 : 1; var amount = aPage ? 5 : 1;
var selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this.tree.view.rowCount-1); this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this.tree.view.rowCount-1);
if (selectedIndex != -1) { if (this.selectedIndex == -1) {
this.selectedIndex = selectedIndex; this.input._focus();
}
else {
this.input.focus();
} }
} catch (ex) { } catch (ex) {
// do nothing - occasionally timer-related js errors happen here // do nothing - occasionally timer-related js errors happen here