Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31122

Re: Interrogation of Shift-Key state

Newsgroups comp.lang.javascript
Date 2016-08-20 00:03 -0700
References (2 earlier) <nkmg47$1b8k$2@gioia.aioe.org> <d052c5aa-94b2-49f9-a493-ea81296acba9@googlegroups.com> <2365735.mvXUDI8C0e@PointedEars.de> <12d9fda2-1369-473e-8415-3739eb04d6a4@googlegroups.com> <4981358.DvuYhMxLoT@PointedEars.de>
Message-ID <da3c74bd-eb1e-457f-9453-8550ecf5717d@googlegroups.com> (permalink)
Subject Re: Interrogation of Shift-Key state
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:
> Michael Haufe (TNO) wrote:
> > Thomas 'PointedEars' Lahn wrote:
> >> Michael Haufe (TNO) wrote:
> >> > So depending on your platform targets, there is a good chance you're
> >> > going to be getting some contradictory information in some cases
> >> > (keydown followed by a keypress and possibly by keyup somewhere in
> >> > there in repetition)
> >> Name one.
> > 
> > <https://bugzilla.mozilla.org/show_bug.cgi?id=602812>
> 
> There is nothing there that corroborates your belief.

Platforms are listed in there as well as in the original link I posted earlier. What exactly are you trying to criticize here? You don't believe the events repeat as listed in the original MDN article? Or you don't like that I generalized the MDN link to include the Shift key in the list of non-character items? 

If you're criticizing the first, that's hard to believe. So I'll assume you're complaining about the latter (which MIGHT be justified depending on platform target), but I hedged my bet by not assuming 100% consistent behavior. I know PPK has discovered inconsistencies in the shift key behavior in the past as well [1], so it isn't unreasonable to be conservative in this case in the absence of information about specific platform targets.

> >> > Which means you are now looking at the keypress event. Luckily, the
> >> > event that is raised has a property called "shiftKey" which you can
> >> > interrogate.
> >> 
> >> The *proprietary/legacy* “keypress” event is not fired for non-character
> >> keys; never has been.  This is how you can tell apart, for example, the
> >> right arrow key ({keyCode: 39, charCode: 0}) and the apostrophe key
> >> ({keyCode: 39, charCode: 39}}; on my laptop with Swiss German keyboard
> >> layout, YMMV).
> > 
> > See the above link
> 
> BTDT.  It says that *in Firefox*

You said it's not fired, and never has been. The link contradicts that claim.

> - “On Windows, CapsLock, NumLock and ScrollLock [did not dispatch the 
>   ‘keypress’] event.
> 
> - On Linux, CapsLock, NumLock and ScrollLock [dispatched the ‘keypress’]
>   event.
> 
> - On Mac, CapsLock dispatched only [the ‘keydown’] event, [the] NumLock key 
>   (without Fn key, i.e., external keyboard's NumLock key) dispatched the 
>   ‘keydown’, ‘keypress’, and ‘keyup’ events.  The NumLock key with Fn key
>   and ScrollLock key don't dispatch any key events.”
> 
> from before “2010-10-08 01:55 PDT” when that bug was reported to before 
> “2013-07-23 11:04:32 PDT” when it was FIXED.
> 
> Who cares?

Apparently you. You claimed: 

"The *proprietary/legacy* “keypress” event is not fired for non-character keys; never has been."

Which is evidently not true, but when presented with reference you now no longer care? Seems like a bad faith criticism from where I'm sitting.

> “Currently, neither modifier keys nor dead keys cause keypress event(s).” 
> (AISB)

That's not what you said before. You've added the qualifier "Currently" where earlier you said "never".

> >> > So now your left with the problem of telling the difference between
> >> > someone holding down the shift key and someone mashing on the keyboard
> >> > in succession.
> >> Most certainly not.
> > 
> > Again, see the above link.
> 
> There is neither a mention that the “keyup” event would be fired while the 
> Shift key were held down, nor is the Shift key mentioned there.

I don't know what you're trying to criticize here either then. "Most certainly not" what?

The link I posted earlier states:

"Auto-repeat on some GTK environments such as Ubuntu 9.4

In some GTK-based environments, auto-repeat dispatches a native key-up event automatically during auto-repeat, and there's no way for Gecko to know the difference between a repeated series of keypresses and an auto-repeat. On those platforms, then, an auto-repeat key will generate the following sequence of events:

    keydown
    keypress
    keyup
    keydown
    keypress
    keyup
    <<repeating until the user releases the key>>
    keyup"

Can you summarize your criticism(s) into a single paragraph for clarity?

[1] <http://www.quirksmode.org/dom/events/keys.html>

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 14:59 +0200
  Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 17:18 +0200
    Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 19:47 +0200
      Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 20:07 +0200
  Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 08:51 -0700
    Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 19:47 +0200
      Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 20:17 +0200
        Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 21:16 +0200
          Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 22:33 +0200
            Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 00:49 +0200
              Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-26 00:06 +0100
              Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-26 11:05 +0200
      Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 12:17 -0700
        Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 12:23 -0700
        Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 00:34 +0200
        Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-18 20:29 +0200
          Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-18 15:17 -0700
            Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-20 07:23 +0200
              Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-20 00:03 -0700
                Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-20 11:48 +0200
                Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-25 13:39 -0700
      Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 12:20 -0700
      Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-25 22:33 +0100
        Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 01:18 +0200
          Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-26 00:23 +0100
            Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 01:37 +0200
              Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-26 09:41 +0100
  Re: Interrogation of Shift-Key state - workaround Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 00:33 +0200
    Re: Interrogation of Shift-Key state - workaround "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-26 00:53 +0200
      Re: Interrogation of Shift-Key state - workaround Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 01:31 +0200
        Re: Interrogation of Shift-Key state - workaround "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 16:52 -0700
        Re: Interrogation of Shift-Key state - workaround "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-26 01:56 +0200
    Re: Interrogation of Shift-Key state - workaround "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 16:50 -0700
  Re: Interrogation of Shift-Key state Joao Rodrigues <jr@none.com> - 2016-06-25 20:34 -0300

csiph-web