AltGr issues on Anki Windows. AltGr + 4 for $ and AltGr+2 for @ do not work

I’ve been struggling with AltGr produced letters in Anki (except in the tag field and the name deck dialogue on the main page), AltGr + 2 is supposed to produce @ on my nordic keyboard, which it often doesn’t in the add-section fields front/back etc. The same applies to reviews, sometimes after I use Ctrl for something else like flagging, AltGr + 2 does not suspend the note anymore

AltGr issues on Anki Windows. AltGr + 4 for $ and AltGr+2 for @ do not work

i disabled the shortcuts add-on so it has nothing to do with that.

If you create a basic (type in the answer) card in a new deck, and type text into the typing box during review, do the keys work there?

Yes they do indeed! Weird. When I start the add section and type right away altgr + 2 does not give @, but when I switch to the “type in answer” type and then back again it works… Sucks having to do that every time though

I wasn’t suggesting that as a workaround, I was just trying to isolate the issue. If you open up the card template screen and add the following to your template on the left:

<div contenteditable=true>click and type here</div>

then click on the right and type in that area, does it work correctly?

It actually is not even a good workaround because I’ve tried to switch to the “type in the answer” card multiple times now, and it and AltGr does still not work (for none of my languages too be it English, German or Norwegian…

Oh and I noticed I am unable to make letters using AltGr in the template editor too

I am still able to add αα/@@ {} etc. in the tag section, but not on the front or back section see image 2

And on image 3 you can see that AltGr is still not working with the <div contenteditable=true>click and type here</div>

The fact that you have the same issue in the review screen seems to point to it being an issue with the toolkit Anki is built on, rather than an issue with Anki’s code. If you try the qt6 test version, do you get the same issue?

I tried it and it seems to work better, 2.1.49 and down don’t work for properly with the altgr (though when it for some reason does work it works well because I am able to let’s say use AltGr + A for alpha, and then shortcuts I have set to ctrl+alt still work!) Which I really liked! Meaning the shortcut I have set to ctrl+alt + A still works. The problem with the new version is that the shortcut overrides the keyboard input. So BOTH ctrl + alt and AltGr produce the same input even though I have a keyboard shortcut set to AltGr. So I’m sticking to 2.1.49 for the time being. Does that make sense? I hope you’re seeing the usecase I am referring to. If not I’d be happy to demonstrate it

To confirm I’ve understood you correctly, are you saying that the Qt 6 build is treating ctrl+alt as AltGr, and ctrl+alt+something is being treated as altgr+something, and not triggering shortcuts? And this happens when using either the left or right alt key?

Yes! Absolutely, have you tried, haven’t you encountered the same bug?
I am supposed to get the “μ” letter when pressing AltGr + m, and a shortcut set to ctrl + alt + m would still be working, but in the new version AltGr acts as ctrl+alt and it is effectively impossible to use altgr for producing character input if a shortcut is set to ctrl+alt+the same key

My main development machine is a Mac, which doesn’t have an AltGr key. Thank you for elaborating; I’ve made a note about this on our issue tracker.

I think it is the same on Linux, AltGr and Ctrl+Alt is not necessarily seen as the same thing. AltGr is for keyboard input while Ctrl+Alt is for keyboard shortcuts.
In most Windows 10 programs this isn’t an issue. If I were to have a shortcut in microsoft word set to ctrl+alt+m I would still be able to type μ with AltGr + m. Normally they shouldn’t really interfere with each other. Or maybe it’s just keyboard input having priority over program shortcuts when it comes to AltGr
Anyway, I think it’s really great, let’s you input more different letters without using alt codes or changing your language etc.

About this, is is still an issue in 2.1.49 , but the thing is, when spamming AltGr around 10+ times and opening different windows it generally works.

So my advice for anyone struggling with this AltGr behavior:
Try typing in different fields such as the edit during review cloze (add-on required)
tag section, browse section, and then switch back. In those cases the AltGr button generally works as long as I keep the Anki window open. If I close and reopen the application I generally have to repeat the process, unless I’m lucky.

So please consider this as you release a new version, that it is nice to be able to have AltGr access a character output, while Ctrl + Alt could still be used as a shortcut for an Anki function without interfering. (Because with the beta version it seemed that AltGr would activate certain keyboard shortcuts at the same time as it produced character output, but I am sure a lot of people would want AltGr to prioritize character output (not the assigned keyboard shortcut, which ctrl+alt can be used for)

As far as I’m aware, these issues are in the graphics toolkit Anki uses, and I’m not aware of a way we can work around them at the moment.

I see, but don’t you think it is weird that it works fine 50% of the time. While other times it just doesn’t work no matter how many times I spam AltGr.

How about the toolkit in the new version, it is not the same right? Will it still distinguish between AltGr for character output and Ctrl+Alt for keyboard shortcuts in Anki? Quite important for me…

I don’t think anyone would want to make dozens of autohotkey scripts for their altgr characters, because when you do that you will get character output every time you use Ctrl + Alt as well. (? I think, unless there’s some Authotkey expert here that can tell me how you create a script for AltGr and NOT ctrl+alt ?)


Hello again, I just wanted to let you know that AltGr for keyboard input seems to be a lot more stable, almost always working on the first try (when opening Anki on Windows 10) on 2.1.54 qt5
As opposed to 2.1.49 like we talked about back in march.

It also seems like it does not interfere with keyboard shortcuts anymore. (please correct me if I am wrong on that – and if anyone else disagrees)

What was the fix? Just the new toolkit?

As @dae said the issue was probably in the toolkit, they likely solved it on their own.

1 Like