anki icon indicating copy to clipboard operation
anki copied to clipboard

The selection highlight of text disappears when Anki loses focus

Open dae opened this issue 1 year ago • 1 comments

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

dae avatar Jun 21 '24 13:06 dae

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…

  1. causes the cursor to not update its position and
  2. 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?

Images

If window has focus (with line 130 removed):

Image Image

If window is unfocused (with line 130 removed):

Image Image

GithubAnon0000 avatar Oct 03 '25 20:10 GithubAnon0000