-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AltGr invokes Ctrl+Alt shortcuts #50341
Comments
@amcsi I agree with you, but this is not under our (VS Code) control and we cannot change this. We are built with Electron, which is built on top of Chromium, which follows w3c standards. Here is where we read a When you press AltGr+B, the event coming our way contains the key code for B and the flags for |
@alexandrudima I don't know that much about Chromium internals, but I would think the problem is with your abstraction layer. On this website I can see that it is possible in Chrome to differentiate between if an alt key press was from the right side of the keyboard. In the screenshot, the bottom two keyup events are me just pressing down AltGr; the keydowns higher up are left Ctrl+Alt. |
@alexandrudima I know for a fact that unfortunately AltGraph is not a reliable way to detect AltGr, evident also by this StackOverflow post: https://stackoverflow.com/questions/10657346/detect-alt-gr-alt-graph-modifier-on-key-press What I wanted to bring to your attention though is the This would probably require additional work to keep track of whether the left or right Alt was pressed down/released in the keydown/keyup events, because probably there's not enough information just looking at the keypress event with its |
Currently, keypress dispatching is stateless. i.e. the event coming in from the browser is treated independent from other events (with the notable exception of chords -- but that has nothing to do with tracking modifiers). In other words, all the data and only the data of event number 3 above is used to dispatch Ctrl+Alt+S Anyways, in my experience, tracking modifiers manually is extremely error prone. (i.e. by manual I mean looking for The reason is that surprisingly often, keydowns/keyups go missing and don't reach us. For example, it is possible to press Ctrl when focused outside of VS Code, then bring focus (via mouse) to VS Code, and then press S and that should be handled as Ctrl+S. The same can happen if focus is moved out of VS Code when a modifier is pressed. Or, sometimes, people use remote desktoping software or other keyboard intercepting software which cause similarly, for events to be dropped. From my limited Windows C++ programming from more than a decade ago, I believe the recommended way was to query if a key is pressed, rather than tracking that by yourself. There is even Anyways, the problem, IMHO, is that:
|
Alright, I see. Thanks for putting in the effort to write all this down though! I can see that because of window focus change issues you definitely cannot rely on mousedown, and if Chromium truly makes it impossible to detect right alt specifically in the keypress event, then unless you made your own Chromium fork, this will be impossible. If that's something that you don't do here, then yes I find it unrealistic that this would ever get fixed here. I rest my case. |
Thank you, I really appreciated the discussion. If you have sufficient energy, please go ahead and bring it up at https://bugs.chromium.org/p/chromium/issues/list . I think being able to distinguish Ctrl+Alt+ from AltGr+ is something any number of web applications would want to do (including the Monaco Editor) and it would only improve the web ecosystem. |
Using US-Int keyboard layout. AltGr+S should make a German ß character. Instead I get the "run task" menu jumping at me. Very annoying. Appreciate not handling AltGr (right alt) the same as ctrl + alt |
https://stackoverflow.com/a/39412714/643011 |
Indeed that works in my Chrome as well |
just nudging on this one as I have just installed on a clean machine and having to go through the list of bindings to find all the ones which override accents is an unnecessary pain. |
This has actually changed in Chromium, so |
Steps to Reproduce:
Expected: a
{
is typedActual: The Ctrl+Alt+B shortcut is invoked
This issue is basically the same as #41225
Whoever closed that ticket quoted that
Ctrl+Alt
andAltGr
should be equivalents based on this wikipedia article, but I digress.It's true that even on Windows you can press
Ctrl+Alt+<key>
to get theAltGr+<key>
equivalent character typed, however it should not be true the other way around.If you read the wikipedia article, it says that the ability was there to make it possible for otherwise AltGr-only characters to be typed. It does not say though that
AltGr
should invoke the hotkeys that are forCtrl+Alt
. If you did, you make it impossible for people using foreign keywords to useCtrl+Alt
shortcut sequences. Windows most certainly does not emitCtrl+Alt
on press ofAltGr
!For reference, in IntelliJ there is a custom option you can enable to make sure
AltGr
does not emitCtrl+Alt
events: https://youtrack.jetbrains.com/issue/IDEA-91975#comment=27-384169The text was updated successfully, but these errors were encountered: