Closed Bug 1436926 Opened 6 years ago Closed 6 years ago

EventUtils.synthesizeKey() should set code value automatically unless the caller specifies code value explicitly

Categories

(Core :: DOM: UI Events & Focus Handling, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(2 files)

When I touch existing tests, I rewrite some tests as: |synthesizeKey("VK_RETURN", {})| to |synthesizeKey("KEY_Enter", { code: "Enter"})| to synthesize actual key event caused by physical keyboard operation.

However, the code value is a code value of ANSI keyboard layout in almost all cases. So, if the caller doesn't specify the code value explicitly, synthesizeKey() should set code value from key or keyCode value automatically.
Comment on attachment 8950528 [details]
Bug 1436926 - part 1: EventUtils.synthesizeKey() should guess KeyboardEvent.code value if it's not specified explicitly

https://reviewboard.mozilla.org/r/219056/#review225668
Attachment #8950528 - Flags: review?(bugs) → review+
Comment on attachment 8950529 [details]
Bug 1436926 - part 2: Remove unnecessary KeyboardEvent.code specification of callers of EventUtils.synthesizeKey()

https://reviewboard.mozilla.org/r/219058/#review225670

rs+

::: toolkit/components/satchel/test/test_form_autocomplete.html:550
(Diff revision 1)
>        break;
>  
>      case 61:
>        checkMenuEntries(["value2"], testNum);
>        // Check the new first entry (of 1)
> -      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
> +      synthesizeKey("KEY_ArrowDown", {});

all fine, bug in case {} is the last param, do we really need it?
Attachment #8950529 - Flags: review?(bugs) → review+
Comment on attachment 8950529 [details]
Bug 1436926 - part 2: Remove unnecessary KeyboardEvent.code specification of callers of EventUtils.synthesizeKey()

https://reviewboard.mozilla.org/r/219058/#review225670

> all fine, bug in case {} is the last param, do we really need it?

Yeah, I think that it should be optional argument.  Then, we can get rid of sendKey().
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s a1ad81ceeed29f6de94c3b64b3358b7606e26b51 -d 0aab6c91fb14: rebasing 447036:a1ad81ceeed2 "Bug 1436926 - part 1: EventUtils.synthesizeKey() should guess KeyboardEvent.code value if it's not specified explicitly r=smaug"
rebasing 447037:077240f46df8 "Bug 1436926 - part 2: Remove unnecessary KeyboardEvent.code specification of callers of EventUtils.synthesizeKey() r=smaug" (tip)
merging layout/forms/test/test_bug348236.html
warning: conflicts while merging layout/forms/test/test_bug348236.html! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/b6768ec01e5a
part 1: EventUtils.synthesizeKey() should guess KeyboardEvent.code value if it's not specified explicitly r=smaug
https://hg.mozilla.org/integration/autoland/rev/b1aba58ebcdd
part 2: Remove unnecessary KeyboardEvent.code specification of callers of EventUtils.synthesizeKey() r=smaug
Priority: -- → P2
https://hg.mozilla.org/mozilla-central/rev/b6768ec01e5a
https://hg.mozilla.org/mozilla-central/rev/b1aba58ebcdd
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: