anki-search-inside-add-card
anki-search-inside-add-card copied to clipboard
Can't select/highlight text after clicking on an Anki field
Describe the bug As soon as an Anki field is selected (active and blue as in the screenshot), I can't select any text in the pdf reader anymore. I have to enter some other field like the tag field or page field (lower right) to deselect the Anki field. Only at that point, I'm able to select/highlight again.
To Reproduce
- Open a pdf
- Select some Anki field
- Try to select some text in the pdf viewer. It doesn't work.
Expected behavior I expect to be able to add some text to an Anki field without making the pdf portion nonselectable.
Screenshots
Environment: macOS Monterey Version 12.4 (21F79)
Version 2.1.53 (96bacf79) Python 3.9.7 Qt 6.3.0 PyQt 6.3.0
Addon version: latest Anki web download as of today.
Enabled Addons: Only this one is enabled
Thanks for the report, I can confirm it. Works in 2.1.52, breaks in 2.1.53. No idea what's causing it. I wrote an issue in the official Anki forums, there are some active devs there, maybe someone has an idea.
https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983
let siacView = document.getElementById('siac-right-side');
siacView.addEventListener('mousedown', function() {
// one solution would be to have a hidden field for this sole purpose
let someNonAnkiField = document.getElementById('siac-pdf-page-inp');
someNonAnkiField.focus();
someNonAnkiField.blur();
}, false);
This is a hacky and unelegant workaround but it works 100% without any unintended behavior. I'm so annoyed at their onBlur trap. They could have done it very differently with regards for addons in my humble opinion.
Also, I'd use a hidden field instead though, for this sole purpose.