Fix inspector toggle on US international keyboards#4516
Fix inspector toggle on US international keyboards#4516dmarcos merged 1 commit intoaframevr:masterfrom
Conversation
On US international keyboards Ctrl + Alt are combined into AltGraph. When this happens Ctrl and Alt are registered as unpressed, breaking the toggle expression
| */ | ||
| onKeydown: function (evt) { | ||
| var shortcutPressed = evt.keyCode === 73 && evt.ctrlKey && evt.altKey; | ||
| var shortcutPressed = evt.keyCode === 73 && (evt.ctrlKey && evt.altKey || evt.getModifierState('AltGraph')); |
There was a problem hiding this comment.
AltGraph is deprecated as per https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState
There was a problem hiding this comment.
Hmm I see. There doesn't seem to be another way to detect ctrl + alt on an US international keyboard. Some sources report that crtlKey and altKey should both be true but that doesn't seem to be the case on both Firefox and Chrome.
The only other solution I can think of right now is to use evt.key === 'í', as í is the key returned when pressing ctrl + alt + i on a US international keyboard. This, however, seems quite layout dependent.
There was a problem hiding this comment.
The link has been updated and AltGraph no longer seems deprecated as far as I can see.
|
Thanks! |
Fixes issue #4089
Related to aframevr/aframe-inspector#598
On US international keyboards Ctrl + Alt are combined into AltGraph. When this happens Ctrl and Alt are registered as unpressed, breaking the toggle expression.
This is fixed by adding an additional clause for the AltGraph combination.
Currently it only works once because a version of aframe-inspector without the fix is loaded. Combined with aframevr/aframe-inspector#598 everything works as expected.