Re: [w3c/uievents] Proposal: Way to determine if any modifier key is pressed (#151)

For a real-world example of why the current boolean flag-based API leads to bugs, see: https://medium.engineering/the-curious-case-of-disappearing-polish-s-fa398313d4df

I think the solution is as easy as adding an API to spit out all the modifiers in one string like Java's [`getKeyModifiersText()`](https://docs.oracle.com/javase/6/docs/api/java/awt/event/KeyEvent.html#getKeyModifiersText(int)) which gives eg `Ctrl+Shift`; any modifiers not included in the string are false. This isn't difficult to do in userland but the API currently affords incorrect usage, and it'd be better to encourage correct usage instead.

I agree that @jonathantneal is talking about something totally different, which is about somehow helping with Ctrl- and Meta- modifiers having different meanings on Mac than they do on Win/Linux; I'm not sure that's something the browser should help with at all. Java, for example, doesn't seem to help with that all, presenting basically the same API as the browser: https://docs.oracle.com/javase/6/docs/api/java/awt/event/InputEvent.html#method_summary

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

Message ID: <w3c/uievents/issues/151/2113298202@github.com>

Received on Wednesday, 15 May 2024 19:21:05 UTC