Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to Prototype: beforeinput event (disabled by default even in Nightly channel)

83 views
Skip to first unread message

Masayuki Nakano

unread,
Jan 8, 2020, 12:46:06 PM1/8/20
to dev-pl...@lists.mozilla.org, sm...@welho.com, Hsin-Yi Tsai
Summary: "beforeinput" event is useful for web apps which manage input
data into `<input>`, `<textarea>` and/or `contenteditable`. This event
is fired before our editor modifies value or DOM tree and some types are
cancelable. Therefore, if some user inputs are not acceptable for the
web app, they can cancel it, and/or modifies the value or the DOM tree
as they want.

Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=970802
Standard: https://w3c.github.io/uievents/#event-type-beforeinput
Platform coverage: all
Preference: dom.input_events.beforeinput.enabled (false by default for now)
DevTools bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1607686

--
Masayuki Nakano <masa...@d-toybox.com>
Working on DOM, Events, editor and IME handling for Gecko

Masayuki Nakano

unread,
Jan 11, 2020, 10:37:47 AM1/11/20
to James Graham, dev-pl...@lists.mozilla.org
On 2020/01/09 3:35, James Graham wrote:
>
> On 08/01/2020 09:54, Masayuki Nakano wrote:
>> Summary: "beforeinput" event is useful for web apps which manage input
>> data into `<input>`, `<textarea>` and/or `contenteditable`. This event
>> is fired before our editor modifies value or DOM tree and some types
>> are cancelable. Therefore, if some user inputs are not acceptable for
>> the web app, they can cancel it, and/or modifies the value or the DOM
>> tree as they want.
>>
>> Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=970802
>> Standard: https://w3c.github.io/uievents/#event-type-beforeinput
>> Platform coverage: all
>> Preference: dom.input_events.beforeinput.enabled (false by default for
>> now)
>> DevTools bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1607686
>
> Are there wpt tests for this feature?

Unfortunately, it's tested only in simple cases:
https://searchfox.org/mozilla-central/search?q=beforeinput&case=false&regexp=false&path=web-platform
The reason is, "beforeinput" event is fired when browser's built-in
editor modifies the DOM, however, most of them the cases are caused by
browser specific shortcut keys, DnD, autocomplete, spellchecker, etc.
Therefore, most of them are tested by mochitest.

> What's the implementation status
> in other browsers?

Blink and WebKit implemented it:
Blink:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/W-Q1yWW-zas
WebKit: https://bugs.webkit.org/show_bug.cgi?id=163021

Except EdgeHTML, Gecko is the last one which does not support
"beforeinput" event.

And also I forgot to write links to Input Events:
Level 1: https://rawgit.com/w3c/input-events/v1/index.html
Level 2: https://w3c.github.io/input-events/

We keep supporting Level 1 for now since Level 2 has some backward
compatibility concerns:
https://github.com/w3c/input-events/issues/87
https://github.com/w3c/input-events/issues/86

(Chrome supports Level 1, Safari supports Level 2 partially.)


James Graham

unread,
Jan 11, 2020, 10:37:50 AM1/11/20
to dev-pl...@lists.mozilla.org, masa...@d-toybox.com

On 08/01/2020 09:54, Masayuki Nakano wrote:
> Summary: "beforeinput" event is useful for web apps which manage input
> data into `<input>`, `<textarea>` and/or `contenteditable`. This event
> is fired before our editor modifies value or DOM tree and some types are
> cancelable. Therefore, if some user inputs are not acceptable for the
> web app, they can cancel it, and/or modifies the value or the DOM tree
> as they want.
>
> Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=970802
> Standard: https://w3c.github.io/uievents/#event-type-beforeinput
> Platform coverage: all
> Preference: dom.input_events.beforeinput.enabled (false by default for now)
> DevTools bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1607686

Are there wpt tests for this feature? What's the implementation status
in other browsers?
0 new messages