fleather
fleather copied to clipboard
Do not open the keyboard when a checkbox is toggled
Steps to Reproduce
On mobile, without the keyboard opened, toggle a checkbox. The keyboard will open.
Not only this is not desired, but if the cursor is very far away from the checkbox, the editor will jump to it.
Environment
- Android (and I guess iOS)
- Flutter version 3.19.3
- Fleather version 1.14.2
Thanks for bringing this to our attention. The reason for this issue is that RawEditorState._didChangeTextEditingValue
is called after every update to FleatherController
and it's responsible for opening keyboard, showing caret and etc. @maelchiotti
I think we need to check if changes are local (remote changes also shouldn't open keyboard) and something other than check state is changed before opening keyboard. WDYT? @amantoux
Hi @Amir-P. Can you think of a temporary fix that I could implement on my side? A user opened an issue corresponding to this problem on my repository.
Hi. I'll take a look at this problem tomorrow and will get back to you. @maelchiotti
Sorry for the delay. I took a look again and as I said before it's due to the fact that we request keyboard and focus every time the controller receives an update (document change, selection change and format toggle). I think we need to change it to match the behavior of Flutter's EditableText which only requests focus and keyboard when receives selection update from user. What do you think? @maelchiotti
Alan I would like to know your thoughts on this too before creating the PR for it. @amantoux
Thank you very much for taking a look at this again. Do not worry about the delay 😊
As you said, matching Flutter's EditableText behaviour makes sense. I will gladly confirm that the fix works correctly when you make a PR.
Sorry for the delay. I took a look again and as I said before it's due to the fact that we request keyboard and focus every time the controller receives an update (document change, selection change and format toggle). I think we need to change it to match the behavior of Flutter's EditableText which only requests focus and keyboard when receives selection update from user. What do you think? @maelchiotti
Alan I would like to know your thoughts on this too before creating the PR for it. @amantoux
@Amir-P makes much sense indeed!
Hi @maelchiotti. It would be a great help if you could test #375 and let me know if you encountered any problems.
Of course! I'll get back to you on Sunday.
@Amir-P works perfectly!
Thanks for checking it. I think we need to request keyboard and focus on toolbar buttons toggle. I'll work on it. @maelchiotti
Thanks for checking it. I think we need to request keyboard and focus on toolbar buttons toggle. I'll work on it. @maelchiotti
@Amir-P do you want me to review the PR without this?
Thank you for fixing this 💖