A bit of a weird one, but we got customers asking why their selection is disappearing when they interact with other pieces in our application.
Turns out, they’re talking about the text selection no longer being visible, but afaik that’s normal browser behavior (like when you were in a text editor, and then switch to a different one, text input, etc…).
However, I looked at Word (on Windows 10) and Google Docs and they do keep it visible, each in their own way:
-
Google Docs’ selection is usually blue, but when you interact with anything else (e.g. the find and replace modal), it turns gray. Same when you switch windows on your computer (and the tab looses focus).
-
Word does something similar, but: there’s no color change, it’s all gray, and moving focus away from the Word window it makes the selection disappear, until you refocus.
Is there a way to show this in a way that’s similar to how Google Docs handles it?
Only way I can see this work is via a custom Decoration plugin, but that seems a bit overkill (e.g. have spans with a class “editor–focus-item” or something) in terms of node changes during selection.
Thanks in advance!