From 42c58e90cbc5b1f19b2ff784225a3e33a8331b4f Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Mon, 2 May 2011 23:21:28 +0200 Subject: [PATCH] set cursor to start of textbox when focusing FS#2243 This works around a new "feature/bug" of Firefox 4. --- lib/scripts/edit.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index e8a59deb9..a96a346dc 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -300,7 +300,11 @@ addInitEvent(function (){ if(edit_text) { if(edit_text.readOnly) return; - // set focus + // set focus and place cursor at the start + var sel = getSelection(edit_text); + sel.start = 0; + sel.end = 0; + setSelection(sel); edit_text.focus(); } -- GitLab