mozKeyboard.selectionEnd is not properly set when using setSelectionRange



6 years ago
6 years ago


(Reporter: sergi, Assigned: janjongboom)


Firefox Tracking Flags

(Not tracked)



(3 attachments)

When setting the cursor using `navigator.mozKeyboard.setSelectionRange` and then retrieving the current position using `navigator.mozKeyboard.selectionEnd`, the latter gives the wrong cursor position and updates erratically.

I created a Gaia branch with a test case in the UITests app. You can find the branch at If you keep clicking in the input field, the cursor will move randomly using `setSelectionRange` but `selectionEnd` doesn't really update properly.
Assignee: nobody → janjongboom
setSelectionRange doesn't synchronous update selectionEnd, but there is an event exposed (onselectionchange) that should fire whenever the selection changes. At the moment this is broken in B2G because the event doesn't bubble up from forms.js where the event originates. I'll append a patch for mozilla-central to this issue.
Attachment #770714 - Flags: review?(rlu)
Attachment #770716 - Flags: review?(rlu)
Hi Jan,

For MozKeyboard related changes, (even it is a one-line patch), I don't feel I am qualified to review since most of the time, I worked on Gaia part.

Could you please ask Fabrice or :yxl to review this?
Thank you.
Flags: needinfo?(xyuan)
Comment on attachment 770714 [details] [diff] [review]
Gecko Patch

Review of attachment 770714 [details] [diff] [review]:

Simple and straightforward. r=+
Attachment #770714 - Flags: review?(rlu) → review+
Flags: needinfo?(xyuan)

To make life easier for those checking in on your behalf, please make sure that future patches are generated following the guidelines below. Note that your commit message should be a description of what the patch is actually doing.
Keywords: checkin-needed
Comment on attachment 770716 [details] [diff] [review]
Gaia patch (for desktop-helper)

r=me with nits addressed.
Please see the comments in the attachment pull request.
Attachment #770716 - Flags: review?(rlu) → review+
Jan & Ryan, thanks for your help.
Closed: 6 years ago
Resolution: --- → FIXED
Hi Ryan, Sorry, I hardly ever land platform stuff. Will take note.
You need to log in before you can comment on or make changes to this bug.