Closed
Bug 1203074
Opened 10 years ago
Closed 10 years ago
sendKeysToElement should append, not prepend, keys
Categories
(Remote Protocol :: Marionette, defect)
Remote Protocol
Marionette
Tracking
(firefox43 fixed)
RESOLVED
FIXED
mozilla43
| Tracking | Status | |
|---|---|---|
| firefox43 | --- | fixed |
People
(Reporter: ato, Assigned: ato)
References
(Blocks 1 open bug)
Details
(Keywords: pi-marionette-server)
Attachments
(1 file)
sendKeysToElement prepends input to text fields rather than appending it. This is because element.focus() in https://dxr.mozilla.org/mozilla-central/source/testing/marionette/sendkeys.js?from=marionette%2Fsendkeys.js#131 places the cursor at the beginning of the input field.
After focussing the element we should move the cursor to the end before we synthesise the key events.
More information about the original reported incident can be found in a wires bug: https://github.com/jgraham/wires/issues/19
| Assignee | ||
Updated•10 years ago
|
Blocks: webdriver
Keywords: ateam-marionette-server
| Assignee | ||
Comment 1•10 years ago
|
||
A fun fact is that I ran into the same issue years ago when I implemented OperaDriver. The relevant code is here: https://github.com/operasoftware/operaprestodriver/blob/master/src/com/opera/core/systems/OperaWebElement.java#L238
| Assignee | ||
Comment 2•10 years ago
|
||
The relevant piece of information is:
// When a TEXTAREA element is focused it returns the cursor to the last position was at, or
// places it last. INPUT @type="text" (or any other textual input element) places the caret at
// the beginning. Because of this we are forced to move the caret to the end of the input
// field. We do this by setting the selection range through JavaScript, which should move the
// cursor to the end of the field upon the next focus event.
| Assignee | ||
Comment 3•10 years ago
|
||
The move caret to end atom:
function() {
return function() {
function a(d) {
d.setSelectionRange(d.value.length, d.value.length)
}
var b = ["_"],
c = this;
!(b[0] in c) && c.execScript && c.execScript("var " + b[0]);
for (var e; b.length && (e = b.shift());) !b.length && void 0 !== a ? c[e] = a : c = c[e] ? c[e] : c[e] = {};;
return this._.apply(null, arguments);
}.apply({
navigator: typeof window != undefined ? window.navigator : null
}, argument + s);
}
| Assignee | ||
Comment 4•10 years ago
|
||
| Assignee | ||
Comment 5•10 years ago
|
||
Bug 1203074: Move caret to end of textual input field before sending keys
When a TEXTAREA element is focused it returns the cursor to the last
position was at, or places it last. INPUT @type="text" (or any other
textual input element) places the caret at the beginning. Because of
this we move the caret to the end of the input field. The next time
the element is focussed, the cursor should move to the end.
r=jgriffin
Attachment #8658723 -
Flags: review?(jgriffin)
| Assignee | ||
Updated•10 years ago
|
Assignee: nobody → ato
Status: NEW → ASSIGNED
Comment 6•10 years ago
|
||
Comment on attachment 8658723 [details]
MozReview Request: Bug 1203074: Move caret to end of textual input field before sending keys
https://reviewboard.mozilla.org/r/18681/#review16707
lgtm
Attachment #8658723 -
Flags: review?(jgriffin) → review+
Comment 8•10 years ago
|
||
This only seems to care about text and text area. Input elements with a control type of text should all handle this. see https://html.spec.whatwg.org/multipage/forms.html#the-input-element.
| Assignee | ||
Comment 9•10 years ago
|
||
(In reply to David Burns :automatedtester from comment #8)
> This only seems to care about text and text area. Input elements with a
> control type of text should all handle this. see
> https://html.spec.whatwg.org/multipage/forms.html#the-input-element.
It makes sense to default to moving the caret since a textual control is the fallback, and create a blacklist of alternate non-textual control types supported by Firefox where should should not attempt to move it.
Filed bug 1203540 fro this.
Comment 10•10 years ago
|
||
sorry had to back this out for test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=13889604&repo=mozilla-inbound
Flags: needinfo?(ato)
Comment 11•10 years ago
|
||
| Assignee | ||
Comment 12•10 years ago
|
||
Comment on attachment 8658723 [details]
MozReview Request: Bug 1203074: Move caret to end of textual input field before sending keys
Bug 1203074: Move caret to end of textual input field before sending keys
When a TEXTAREA element is focused it returns the cursor to the last
position was at, or places it last. INPUT @type="text" (or any other
textual input element) places the caret at the beginning. Because of
this we move the caret to the end of the input field. The next time
the element is focussed, the cursor should move to the end.
The layout touch caret tests relied on the caret being left in its
previous position. This patch addresses that by using the advanced user
interaction API for these test cases.
r=jgriffin
| Assignee | ||
Comment 13•10 years ago
|
||
Comment on attachment 8658723 [details]
MozReview Request: Bug 1203074: Move caret to end of textual input field before sending keys
jgriffin: Mind taking another look? I had to make some changes to the layout/base/tests/marionette/test_touchcaret.py tests.
Flags: needinfo?(ato)
Attachment #8658723 -
Flags: review+ → review?(jgriffin)
Comment 14•10 years ago
|
||
Comment on attachment 8658723 [details]
MozReview Request: Bug 1203074: Move caret to end of textual input field before sending keys
https://reviewboard.mozilla.org/r/18681/#review17469
Attachment #8658723 -
Flags: review?(jgriffin) → review+
| Assignee | ||
Comment 15•10 years ago
|
||
Comment 16•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Updated•3 years ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•