mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 14:27:59 +01:00
Fix input caret in input elements on initial focus.
This commit is contained in:
@@ -463,6 +463,10 @@ var Buffer = Module("buffer", {
|
|||||||
var flags = services.focus.FLAG_BYMOUSE;
|
var flags = services.focus.FLAG_BYMOUSE;
|
||||||
else
|
else
|
||||||
flags = services.focus.FLAG_SHOWRING;
|
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);
|
dactyl.focus(elem, flags);
|
||||||
|
|
||||||
if (elem instanceof Window) {
|
if (elem instanceof Window) {
|
||||||
|
|||||||
@@ -1246,6 +1246,7 @@ var Events = Module("events", {
|
|||||||
focus: function onFocus(event) {
|
focus: function onFocus(event) {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
|
|
||||||
|
elem.dactylHadFocus = true;
|
||||||
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
|
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
|
||||||
if (Events.isHidden(elem, true))
|
if (Events.isHidden(elem, true))
|
||||||
elem.blur();
|
elem.blur();
|
||||||
|
|||||||
Reference in New Issue
Block a user