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

@masayuki-nakano, thank you for the reply.

> Sounds like it's a different issue.

Should I open a new issue? Is this issue for detecting the OS-specific modifier (or primary accelerator key?).

When I first looked at this issue, I thought it might be different when read “the solution should be able to determine if one or more modifier keys are truthy” as that seems ‘greedy’, but then it is followed by, “while ensuring rest of the available modifier keys are falsey” which makes me think it is the same as my need.

Which would be best for the working group? This issue? A new issue? ... no issue? 😅

> it was deleted

Thank you for that link. I see that they mention that we should open new bugs to track any further issues we encounter. Would my issue and the prior art that I’ve shared qualify?

> Although Gecko still supports it.

Upon a brief cross browser testing with the following code, it seems that Firefox and all Chromium browsers support `event.getModifierState('Accel')`. It turned out that the only browser which did not support this was Safari.

```html
<pre id="log"></pre>
window.addEventListener('keydown', event => {
 event.preventDefault()

 log.textContent = JSON.stringify({
  key: event.key,
  Accel: event.getModifierState('Accel'),
  Meta: event.getModifierState('Meta'),
  Control: event.getModifierState('Control'),
  Option: event.getModifierState('Option'),
  Alt: event.getModifierState('Alt'),
 }, null, '  ')
})
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/151#issuecomment-1307206391

You are receiving this because you are subscribed to this thread.

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

Received on Tuesday, 8 November 2022 13:17:25 UTC