On Wed, Jan 17, 2018 at 6:34 PM, Masayuki Nakano <masay...@d-toybox.com> wrote:
> Hello, everyone. > > Please stop using keypress event for handling non-printable keys in new > code when you write new code and new automated tests. Firefox will stop > dispatching keypress events for non-printable keys for conforming to UI > Events and struggling with web compatibility. (non-printable key means key > combination which won't cause inputting character, e.g., arrow keys, > backspace key and Ctrl (and/or Alt) - "A" key, etc.) > > You can perhaps just use keydown event instead. KeyboardEvent.key and > KeyboardEvent.keyCode of non-printable key events are always same. > Difference between keydown event and keypress event is > KeyboardEvent.charCode of printable keys (and Ctrl/Alt + printable keys). > So, when you need to use only key or keyCode, please use keydown event. > Otherwise, when you need to use charCode, please keep using keypress event. > > Background: > > We need to fix bug 968056 (*1) for web-compat issues. > > Currently, Firefox dispatches keypress events for any keys except modifier > keys. This is traditional behavior from Netscape Navigator. However, this > is now invalid behavior from a point of view of standards (*2). > > I'm going to start to work on the bug from next week. However, this > requires to rewrite too many keypress event handlers in our internal code > and our automated tests. So, please stop using keypress event when you > want to handle non-printable keys at least in new code. > Could someone who is knowledgeable about ES lint comment on whether it is possible to leverage ES lint to draw a line in the sand, at least on the JavaScript side of the house? Nick _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform