Skip to content

Conversation

@svenkonings
Copy link
Contributor

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.

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'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link has been updated and AltGraph no longer seems deprecated as far as I can see.

@dmarcos
Copy link
Member

dmarcos commented Jan 22, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants