Re: [w3c/uievents] Add specification for AltGraph key & modifier behaviour (#147)

> Scans the keyboard layout to establish whether it uses AltGraph (i.e. does Ctrl+Alt+ generate a character for any value of ?).

I don't think that it's good idea due to performance reason. Although if doing it makes web developers really happy, we could take the approach.

> Re the event sequence: It's possible to "hold" the keydown-ControlLeft and not dispatch it to content if it turns out to be AltGr, as part of the logic I've prototyped (see above), but as well as adding complexity, is there a risk that existing content relies on "seeing" both events for AltGr?

I don't think that Browsers should put off to dispatch Ctrl or Alt key down. E.g., if user Ctrl or Alt is down, then, mouse move, finally, other one is pressed, how should browsers do? Only optimizing for modifier keydown event doesn't make sense to me.

> We can still have the AltGraph modifier set correctly on events, but I don't think it will be possible to generate keydown/keyup events for Option itself, with the correct KeyboardEvent.key values?

Yes, but I don't think that it's important to fire "AltGr" keydown event because most web apps don't need to listen modifier keydown events. If some web apps need to do that, they can do it with listening to all keydown events and check getModifierState("AltGraph").

> Do you know offhand how Linux distributions handle that, given that they don't have the Ctrl+Alt fall-back for AltGr?

Looks like that it depends on user settings. At least, Ubuntu has GUI to set specifying "AltGr" key for Level3 and Level 5 to a key or a key combination. For example, user can set CapsLock to AltGr, Backslash to AltGr, Menu ("ContextMenu") to AltGr, etc. So, cannot do any hack for modifier keydown on Linux.

I believe that if web apps need to handle AltGr keydown and keyup, they should do:

```
var isAltGrDown = false;
foo.addEventListener("keydown", (event)=>{
  isAltGrDown = event.getModifierState("AltGraph");
});
foo.addEventListener("keyup"), (event)=>{
  isAltGrDown = event.getModifierState("AltGraph");
}); 
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/147#issuecomment-316112431

Received on Tuesday, 18 July 2017 16:06:33 UTC