summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-08-14 16:27:01 -0400
committerKris Maglione <maglione.k@gmail.com>2011-08-14 16:27:01 -0400
commit8a3c6a7ea3a5f75026d1ebf6f5152dd9cd17d9a6 (patch)
tree969930eb154147dd335a9091ae69ed2f6e4d2ad5 /common
parent9273db48abab3ccb84523501f8a701c78d9be3d0 (diff)
downloadpentadactyl-8a3c6a7ea3a5f75026d1ebf6f5152dd9cd17d9a6.tar.gz
Fix input caret in input elements on initial focus.
Diffstat (limited to 'common')
-rw-r--r--common/content/buffer.js4
-rw-r--r--common/content/events.js1
2 files changed, 5 insertions, 0 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index b347eeaf..d63630c8 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -463,6 +463,10 @@ var Buffer = Module("buffer", {
var flags = services.focus.FLAG_BYMOUSE;
else
flags = services.focus.FLAG_SHOWRING;
+
+ if (!elem.dactylHadFocus && elem.value && elem.selectionStart == elem.selectionEnd)
+ elem.selectionStart = elem.selectionEnd = elem.value.length;
+
dactyl.focus(elem, flags);
if (elem instanceof Window) {
diff --git a/common/content/events.js b/common/content/events.js
index 3e31103b..6e3471f1 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -1246,6 +1246,7 @@ var Events = Module("events", {
focus: function onFocus(event) {
let elem = event.originalTarget;
+ elem.dactylHadFocus = true;
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
if (Events.isHidden(elem, true))
elem.blur();