fleather icon indicating copy to clipboard operation
fleather copied to clipboard

Do not open the keyboard when a checkbox is toggled

Open maelchiotti opened this issue 11 months ago • 1 comments

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

maelchiotti avatar Mar 25 '24 20:03 maelchiotti

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

Amir-P avatar Apr 02 '24 08:04 Amir-P

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.

maelchiotti avatar Jun 30 '24 08:06 maelchiotti

Hi. I'll take a look at this problem tomorrow and will get back to you. @maelchiotti

Amir-P avatar Jun 30 '24 09:06 Amir-P

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 avatar Jul 03 '24 11:07 Amir-P

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.

maelchiotti avatar Jul 03 '24 11:07 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

@Amir-P makes much sense indeed!

amantoux avatar Jul 03 '24 15:07 amantoux

Hi @maelchiotti. It would be a great help if you could test #375 and let me know if you encountered any problems.

Amir-P avatar Jul 05 '24 19:07 Amir-P

Of course! I'll get back to you on Sunday.

maelchiotti avatar Jul 05 '24 20:07 maelchiotti

@Amir-P works perfectly!

maelchiotti avatar Jul 07 '24 07:07 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 avatar Jul 07 '24 08:07 Amir-P

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?

amantoux avatar Jul 07 '24 08:07 amantoux

Thank you for fixing this 💖

maelchiotti avatar Jul 17 '24 13:07 maelchiotti