The selection highlight of text disappears when Anki loses focus
This is a bug report Steps to reproduce:
Run Anki-24.04.1 on X11 Linux. Open the card browser and select some text in a field. The selected text gets a blue selection highlight. Focus on another window, causing the browser window to lose focus. The blue selection highlight now disappears and you can’t tell what is selected.
Originally reported on https://forums.ankiweb.net/t/the-selection-highlight-of-text-disappears-when-anki-loses-focus/46113/3
More Info
The problem appears to be in this code:
https://github.com/ankitects/anki/blob/1f9d943c8d33020301d449af3070f95617faf734/ts/editor/code-mirror.ts#L106-L144
Removing the unsubscribe() call fixes the issue, were the text selection disappears if the window is unfocused.
It's not a solution though, as removing the unsubscribe() call also…
- causes the cursor to not update its position and
- text selections won't disappear if you click into another field, e.g. into the "back" field and select text there.
This only happens for the html view, so maybe something in ts/editor/plain-text-input is bugged as ts/editor/rich-text-input works fine?