AppFlowy-IO / appflowy-editor

A highly customizable rich-text editor for Flutter. The AppFlowy Editor project for AppFlowy and beyond.
https://pub.dev/packages/appflowy_editor
Other
469 stars 198 forks source link

[Bug] Mobile keyboard can't open if the line is empty #549

Open CatHood0 opened 1 year ago

CatHood0 commented 1 year ago

Bug Description

The keyboard cannot open when the line is empty in the editor, this which happens only when using MobileFloatingToolbar

How to Reproduce

Write something, and put a new line, then close the keyboard, and try to open the keyboard and continue writing in the empty line (apply also to empty list). It cannot be the first one

Expected Behavior

The keyboard open again when select a line

Operating System

Android

AppFlowy Editor Version(s)

89b93d8

Screenshots

https://github.com/AppFlowy-IO/appflowy-editor/assets/114286961/98b2053a-48fc-4a48-b8a4-7abfd2e6a375

Additional Context

No response

rituraj2000 commented 1 year ago

Hi @CatHood0 I am new to Opensource! I would love this to mark my starting point of opensource journey. Could you please assign this to me ?

CatHood0 commented 1 year ago

@LucasXu0 can you assign this issue to @rituraj2000 ? I cannot do it

LucasXu0 commented 1 year ago

@CatHood0 I can't reproduce this issue in the latest version of the main branch. I believe it has been fixed.

CatHood0 commented 1 year ago

I updated the version to the current, and it's still happening

Here another video about it (i don't have the current version of the example, so i show this my app)

https://github.com/AppFlowy-IO/appflowy-editor/assets/114286961/e841eca5-e1f3-4cbb-a8a3-ec7c5a193916

I realized that the error occurs when you select an empty line and after opening the keyboard, close it and then try to open it once again (I do this in the video).

The problem is partially solved, since now after having selected any line that is not empty, if I try to close the keyboard and play the same thing, in reality it will work again as it should (opening the keyboard without caring if the line is empty or not , and this did not happen in version 1.5.0 of the package). However, if we stay on that empty line, close the keyboard and then try to select another one again, the error appears again.

MarsadMaqsood commented 12 months ago

Flutter: 3.16.0 appflowy_editor: 2.0.0

@LucasXu0 Steps to reproduce the issue

Video 1 https://github.com/AppFlowy-IO/appflowy-editor/assets/53562046/e4dfad28-7d3e-484a-bbaa-107544479df6
Video 2 https://github.com/AppFlowy-IO/appflowy-editor/assets/53562046/5ec3f60d-c63d-4eb6-a3de-eb6e8d7d7c75

I/flutter ( 4531): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter ( 4531): The following ArgumentError was thrown while handling a gesture:
I/flutter ( 4531): Invalid argument(s): 0
I/flutter ( 4531): 
I/flutter ( 4531): When the exception was thrown, this was the stack:
I/flutter ( 4531): #0      int.clamp (dart:core-patch/integers.dart:307:7)
I/flutter ( 4531): #1      _MobileSelectionServiceWidgetState._getNodeInOffset (package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart:446:15)
I/flutter ( 4531): #2      _MobileSelectionServiceWidgetState.getNodeInOffset (package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart:150:12)
I/flutter ( 4531): #3      _MobileSelectionServiceWidgetState.getPositionInOffset (package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart:184:18)
I/flutter ( 4531): #4      _MobileSelectionServiceWidgetState._onTapUp (package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart:234:22)
I/flutter ( 4531): #5      MobileSelectionGestureDetectorState._tapDownDelegate (package:appflowy_editor/src/service/selection/mobile_selection_gesture.dart:103:24)
I/flutter ( 4531): #6      TapGestureRecognizer.handleTapUp.<anonymous closure> (package:flutter/src/gestures/tap.dart:649:57)
I/flutter ( 4531): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
I/flutter ( 4531): #8      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:649:11)
I/flutter ( 4531): #9      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:309:5)
I/flutter ( 4531): #10     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:279:7)
I/flutter ( 4531): #11     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:167:27)
I/flutter ( 4531): #12     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:492:20)
I/flutter ( 4531): #13     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
I/flutter ( 4531): #14     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:439:11)
I/flutter ( 4531): #15     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
I/flutter ( 4531): #16     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
I/flutter ( 4531): #17     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
I/flutter ( 4531): #18     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
I/flutter ( 4531): #19     _invoke1 (dart:ui/hooks.dart:328:13)
I/flutter ( 4531): #20     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:410:7)
I/flutter ( 4531): #21     _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
I/flutter ( 4531): 
I/flutter ( 4531): Handler: "onTapUp"
I/flutter ( 4531): Recognizer:
I/flutter ( 4531):   TapGestureRecognizer#615e5
I/flutter ( 4531): ════════════════════════════════════════════════════════════════════════════════════════════════════
saif-ellafi commented 2 weeks ago

Not sure if it is exactly related, but what happens to me, is, if I close the keyboard, then tapping again on the text won't bring the keyboard up again (Android). I could work around this by calling unfocus() when tapping outside but it is not ideal.