anki-custom-shortcuts
anki-custom-shortcuts copied to clipboard
[Bug] In editor: Shortcuts won't work after clicking outside of the active/focused field
Hi, the addon breaks when you click anywhere else than on a field while being in the editor :/ One has to click another field and back to the desired field of choice to reactivate the shortcuts.
Native shortcuts on the other hand, like CMD+B for Bold, continue to work.
I have a hunch that this newly added focusTrap might be causing this (https://github.com/ankitects/anki/pull/1861) but I haven't looked at the code yet.
Also, I've disabled all other addons before testing ofc!
I've made a video to illustrate the issue:
https://user-images.githubusercontent.com/11823348/184041038-bd8ebcdf-bcfa-48dc-900f-5801fe125092.mp4
Version Info |
---|
macOS Monterey |
Version 12.4 |
Version 2.1.54 (b6a7760c) |
Python 3.9.7 Qt 6.3.1 PyQt 6.3.1 |
Hello, Based just on the bug report this one might take a while to figure out, but I am able to fully reproduce what's going on in the video. For the time being, a somewhat ridiculous workaround that I found was to select another field and then select the original field, which restores the shortcut functionality (until clicking away again).
My initial hunch turned out to be right and I've managed to find a solution.
However, I'm not 100% sure that my fix is without consequences. From my understanding of 8270ce1, there was a slight oversite in regards to the shortcut handling. I've gone into detail about it here: https://github.com/ankitects/anki/pull/1861#issuecomment-1214477083.
for row in cuts:
if len(row) == 2:
keys, fn = row
#fn = self._addFocusCheck(fn)
else:
keys, fn, _ = row
scut = QShortcut(QKeySequence(keys), self.widget, activated=fn)
You can just comment this out for now in your monkey patch and it should work fine.
I've noticed this as well, very frustrating.
I've noticed this as well, very frustrating.
Idk why he hasn't merged it. But you can just use my fork. It works without any issues.