On 18/01/2018 17:36, Mark Banner wrote:
On 18/01/2018 16:56, Nicholas Alexander wrote:
On Wed, Jan 17, 2018 at 6:34 PM, Masayuki Nakano
<masay...@d-toybox.com <mailto: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.)
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?
If I understand correctly, Masayuki is asking that we stop doing
things like `document.addEventListener("keypress", detectKeyEvent);`
when expecting a non-printable key. If so, that isn't going to be
possible unless keypress is being banned completely.
The problem is we'd need to do analysis of the listener function and
what's happening inside it, and that would be too complicated for us
to handle in ESLint.
We can do things like ban the use of a particular function, or a
function with specific parameters quite easily, but once we need to
start looking into actual details, then it tends to be too difficult.
Ah, yeah, I missed the 'figure out whether we care about non-printable
keys' bit. On the other hand, I doubt we really use lots of keypress
listeners for printable characters in frontend JS? By the sounds of it,
all types of shortcuts are basically non-printable, and the only things
that would be printable would be actual text input. Apart from maybe the
urlbar or searchbar (where I'd still expect us to use 'input' events
rather than 'keypress'), I somewhat doubt we have loads of those
handlers... so it might be worth having a (temporary?) eslint rule that
warned for keypress listener additions and adding comments to the ones
that we need for printable keys in the rare cases where that happens.
~ Gijs
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform