Closed Bug 889347 Opened 11 years ago Closed 11 years ago

mozKeyboard.selectionEnd is not properly set when using setSelectionRange

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

x86_64
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sergi, Assigned: janjongboom)

References

Details

Attachments

(3 files)

Attached file Branch with testcase
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 https://github.com/comoyo/gaia/tree/test_selection_end. If you keep clicking in the input field, the cursor will move randomly using `setSelectionRange` but `selectionEnd` doesn't really update properly.
Blocks: 851072
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)
https://hg.mozilla.org/projects/birch/rev/7945c16d34e3

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.
https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F
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.
https://hg.mozilla.org/mozilla-central/rev/7945c16d34e3
Status: NEW → RESOLVED
Closed: 11 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.

Attachment

General

Created:
Updated:
Size: