Open miguelcmedeiros opened 2 weeks ago
Cc @matthew-carroll @angelosilvestre
Possibly seems like app lifecycle event being reported wrong on macOS. Looking into it.
Nevermind, that was a red herring. Super_editor unfocuses on IME disconnected, but it only refocuses (and thus restores selection) when being interacted or scrolling. So this seems like super_editor issue?
@knopp is there a way to identify the situation where the window loses focus and regains it? In the case where the IME connection closes but the focus remains in the current window, I think we probably have the desired behavior. I think it's only when switching between windows that we're seeing an undesirable policy. But I'm not sure where to detect that situation.
Also @miguelcmedeiros experimented with a standard Flutter text field and it appears that in some manner it retains focus between window focus changes. Miguel found that when typing in a regular Flutter text field, it seems to retain caret position when regaining window focus, and also allows for immediate typing through the IME connection.
SuperTextField somehow has a middle ground. When the Flutter window regains focus the SuperTextField regains a selection, but the selection places the caret at the end of the content. Despite the caret, you can't type into the SuperTextField until the user taps on it (probably to give it focus).
We should create a consistent result for window focus change.
CC @angelosilvestre
Package Version super_editor main branch (commit https://github.com/superlistapp/super_editor/commit/7eae101b6f1b12956aa1bb348139f50689b61244).
User Info Superlist
To Reproduce Steps to reproduce the behavior:
Actual behavior Selection is cleared.
Expected behavior Selection should be the same as before switching to another application.
Platform macOS and web.
Flutter version master
Screenshots
https://github.com/user-attachments/assets/900f7d87-0398-4ba7-aa44-bda84de84d46