Bug 1113581 - Artifact when editing a keyword, the keyword is displayed under the text-area. r?jaws
MozReview-Commit-ID: 6toSvZlJeBz
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -378,45 +378,48 @@
input.value = this.view.getCellText(row, column);
var selectText = function selectText() {
input.select();
input.inputField.focus();
}
setTimeout(selectText, 0);
+ // Clear the text because we don't want the text appearing underneath the input.
+ this.view.setCellText(row, column, "");
+ // Save the original text so we can restore it after stoping editing.
+ input.setAttribute("data-original-text", input.value);
+
this._editingRow = row;
this._editingColumn = column;
-
this.setAttribute("editing", "true");
return true;
]]>
</body>
</method>
<method name="stopEditing">
<parameter name="accept"/>
<body>
<![CDATA[
if (!this._editingColumn)
return;
var input = this.inputField;
var editingRow = this._editingRow;
var editingColumn = this._editingColumn;
+ var value = accept ? input.value : input.getAttribute("data-original-text");
this._editingRow = -1;
this._editingColumn = null;
- if (accept) {
- var value = input.value;
- this.view.setCellText(editingRow, editingColumn, value);
- }
+ this.view.setCellText(editingRow, editingColumn, value);
input.hidden = true;
input.value = "";
this.removeAttribute("editing");
+ input.removeAttribute("data-original-text");
]]>
</body>
</method>
<method name="_moveByOffset">
<parameter name="offset"/>
<parameter name="edge"/>
<parameter name="event"/>