Closed Bug 1387828 Opened 7 years ago Closed 7 years ago

Reinstate support for initKeyboardEvent with optional arguments

Categories

(Core :: DOM: Events, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: ayg, Assigned: ayg)

Details

Attachments

(1 file)

Historically we supported a KeyEvent type.  Eventually the standard said to support KeyboardEvent, so we did.  It's supposed to have an initKeyboardEvent initializer, which was added in bug 930893, but it was removed in bug 999645 because it broke a browser add-on.  It seems the add-on in question assumed that some of the arguments were optional, which Chrome does, and our implementation had all arguments required.

The problem is that other browsers do support this method and probably can't drop support, so for interop we should support it.  See discussion here:

https://github.com/w3c/web-platform-tests/pull/4117
https://github.com/w3c/uievents/issues/112

smaug was in favor of trying to re-add it with optional arguments.
Comment on attachment 8894219 [details]
Bug 1387828 - Reinstate support for initKeyboardEvent;

https://reviewboard.mozilla.org/r/165304/#review170588

::: dom/webidl/KeyboardEvent.webidl:32
(Diff revision 1)
>    readonly attribute boolean       isComposing;
>  
>    readonly attribute DOMString key;
>    readonly attribute DOMString code;
>  
> +  [Throws]

I don't understand why these params. Why for example no code?
Could you please give a link to some spec which also other browser vendors agree.
Attachment #8894219 - Flags: review?(bugs)
Comment on attachment 8894219 [details]
Bug 1387828 - Reinstate support for initKeyboardEvent;

https://reviewboard.mozilla.org/r/165304/#review170588

> I don't understand why these params. Why for example no code?
> Could you please give a link to some spec which also other browser vendors agree.

Microsoft docs: https://msdn.microsoft.com/en-us/library/ff975297(v=vs.85).aspx
Blink source: https://src.chromium.org/viewvc/blink/trunk/Source/core/events/KeyboardEvent.idl#l43
WebKit source: https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/KeyboardEvent.idl#L52
Spec: https://w3c.github.io/uievents/#dom-keyboardeveng-initkeyboardevent

Note that they all agree in the names of the first six parameters, but Microsoft/spec differ from Blink/WebKit for parameters after that.  I don't know if the semantics agree for the first six.  Hopefully it won't matter for web compat?  Probably the Blink/WebKit behavior is more compatible, so if you want we can ask for the spec to change instead of matching it.
Attachment #8894219 - Flags: review?(bugs)
In the spec the method doesn't take any param o_O
Comment on attachment 8894219 [details]
Bug 1387828 - Reinstate support for initKeyboardEvent;

https://reviewboard.mozilla.org/r/165304/#review170594

I think we need the spec clarified before making the change. Browser vendors should agree on this. And if not, and given that this is deprecated method, we should probably follow blink/webkit.
Attachment #8894219 - Flags: review?(bugs)
Comment on attachment 8894219 [details]
Bug 1387828 - Reinstate support for initKeyboardEvent;

https://reviewboard.mozilla.org/r/165304/#review173644
Attachment #8894219 - Flags: review?(bugs) → review+
Pushed by ayg@aryeh.name:
https://hg.mozilla.org/integration/autoland/rev/8ee32af87bd4
Reinstate support for initKeyboardEvent; r=smaug
https://hg.mozilla.org/mozilla-central/rev/8ee32af87bd4
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: