New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard closes on tap outside of super editor in Mobile Web #1979
Comments
At first glance, this doesn't look like a The focused widget receives key events and IME input, so Super Editor can't keep the keyboard open if focus moves to a different widget. My guess is that tapping on the toggle button is changing focus to that button.
@angelosilvestre do you have any other thoughts on this? |
It is not necessarily a button. Tapping on any surface in Mobile Web closes the keyboard (material TextField as well). Another problem is that the SuperEditor stays focused (or at least paints the cursor). RPReplay_Final1714545251.mov |
Right. I didn't say it was about the button. I said it was about the focus node that's probably inside the button, which is probably receiving focus when you tap on it.
This may or may not be a bug. Depends on the exact situation. |
By default, If you want to keep the keyboard visible, you need to either:
|
@hawkkiller please let us know if Angelo's message resolved your issues. |
Hi @matthew-carroll @angelosilvestre I've just verified that neither setting tap regions, focus nodes, or configuring the policy doesn't work (at least for the code provided). Do you have any suggestions to check? Widget build(BuildContext context) => MaterialApp(
home: Builder(builder: (context) {
return Scaffold(
body: Padding(
padding: MediaQuery.of(context).padding,
child: Focus(
focusNode: _focusNode,
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Center(
child: TapRegion(
groupId: 'super_editor',
child: ToggleButtons(
onPressed: (index) {},
isSelected: const [false, false, false],
children: const [
Icon(Icons.ac_unit),
Icon(Icons.call),
Icon(Icons.cake),
],
),
),
),
),
SliverToBoxAdapter(
child: SuperEditor(
imePolicies: const SuperEditorImePolicies(
closeKeyboardOnSelectionLost: false,
closeImeOnNonPrimaryFocusLost: false,
closeKeyboardOnLosePrimaryFocus: false,
),
tapRegionGroupId: 'super_editor',
focusNode: _focusNode,
editor: editor,
document: document,
composer: composer,
),
),
],
),
),
),
);
}),
); |
@hawkkiller Please try to do something like this: Widget build(BuildContext context) => MaterialApp(
home: Builder(builder: (context) {
return Scaffold(
body: Padding(
padding: MediaQuery.of(context).padding,
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Center(
child: Focus(
focusNode: _buttonsFocusNode,
parentNode: _editorFocusNode,
child: ToggleButtons(
onPressed: (index) {},
isSelected: const [false, false, false],
children: const [
Icon(Icons.ac_unit),
Icon(Icons.call),
Icon(Icons.cake),
],
),
),
),
),
SliverToBoxAdapter(
child: SuperEditor(
focusNode: _editorFocusNode,
editor: editor,
document: document,
composer: composer,
),
),
],
),
),
);
}),
); |
@angelosilvestre Keyboard still closes and this happens only on the Mobile Web (where clicking anywhere closes the keyboard by default for some reason, which is not typical for other platforms). For example, this issue doesn't occur on mobile (if launched not via Web). |
If you need assistance with debugging, testing, or experimenting with potential fixes for this problem, I'm happy to help you. |
@hawkkiller Did you try to use my sample code and also provide the IME policies? |
@angelosilvestre Yes! |
Package Version
Github, main
To Reproduce
Steps to reproduce the behavior:
Minimal Reproduction Code
Minimal, Runnable Code Sample
Actual behavior
Keyboard closes.
Expected behavior
The keyboard is not closed.
Platform
iOS Web.
Additional context
In flutter docs, there is a TextFieldTapRegion that seems to work with text fields (though with some problems).
I have tried wrapping toggle buttons in TapRegion and providing the same group id to SuperEditor, but it doesn't seem to work.
cc: @matthew-carroll @angelosilvestre
The text was updated successfully, but these errors were encountered: