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
On iOS, VoiceOver incorrectly activated the pop-up keyboard after touching TextField #94465
Comments
@luomo-pro
With what you said, does following above steps, open the keyboard for you ? stable, master, beta flutter doctor -v
|
@darshankawar After you perform the above steps, in the flutter application, let go after a finger touches the textfield, you will find that the textfield is activated and the keyboard pops up directly. |
@luomo-pro
I see the keyboard still open as I popped up in step 2 above. If I follow first 2 steps without popping the keyboard and follow rest of the steps and select RPReplay-Final1638515151.MP4 |
hi
In native, even if the typing mode is touch typing, it is the same as standard typing. You must double-click the screen to get the textfield to get the input focus. Do you understand what I said above? |
Thanks for the details which helped to replicate the issue properly using below code sample.
stable, master flutter doctor -v
|
I am also a blind developer. I think blind friends who use accessibility will encounter this problem. This problem has caused them serious troubles. I hope it can be resolved as soon as possible. Thank you very much to the Flutter team. |
I'm writing a software for office work that uses a lot of TextField, and I've had a lot of feedback from blind users about this issue. |
it sounds like iOS is sending the touch event differently when the touch typing is enabled, we may need to do a special treament if that setting is turned on |
I have the same problem, after touching textfield, it is activated by mistake and the keyboard pops up automatically. |
I also met the same problem, TextField will automatically get focus and pop-up keyboard, this problem has existed for a long time, what is the progress now? |
Hello, |
Hey guys. I see that the last post is from a year and a half ago, but the problem still persists in the current version of Flutter. I managed to get around it very easily. Here: https://github.com/s17476/semantic_text_field I made a repo presenting the operation and below is my solution. Of course, this is the minimum code sample needed for TextField to function properly. class SemanticTextField extends StatefulWidget {
const SemanticTextField({
Key? key,
this.decoration,
this.controller,
this.onChanged,
}) : super(key: key);
final InputDecoration? decoration;
final TextEditingController? controller;
final Function(String)? onChanged;
@override
State<SemanticTextField> createState() => _SemanticTextFieldState();
}
class _SemanticTextFieldState extends State<SemanticTextField> {
late final TextEditingController _textEditingController;
final FocusNode _focusNode = FocusNode();
bool _isKeyboardVisible = false;
String? _getSemanticLabel() {
if (Platform.isAndroid) {
return null;
}
// Add translations here
// Textfield
final textFieldLabel = 'Pole tekstowe';
// Edition
final editingLabel = 'Edycja';
// Double tap to edit
final doubleTapLabel = 'Stuknij dwukrotnie aby edytować';
var label = _textEditingController.text.isEmpty
? widget.decoration?.hintText ?? ''
: '';
label += ';$textFieldLabel';
label += ';${_isKeyboardVisible ? editingLabel : doubleTapLabel}';
return label;
}
@override
void initState() {
_textEditingController = widget.controller ?? TextEditingController();
_focusNode.addListener(() {
setState(() {
_isKeyboardVisible = _focusNode.hasFocus;
});
});
super.initState();
}
@override
void dispose() {
if (widget.controller == null) {
_textEditingController.dispose();
}
_focusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Semantics(
value: Platform.isIOS ? _textEditingController.text : null,
label: _getSemanticLabel(),
child: ExcludeSemantics(
excluding: Platform.isIOS,
child: TextField(
controller: _textEditingController,
focusNode: _focusNode,
decoration: widget.decoration ?? const InputDecoration(),
onChanged: (value) {
setState(() {});
widget.onChanged?.call(value);
},
),
),
);
}
} I hope this will be useful to someone. Our blind consultant is satisfied with the operation of this solution. |
@s17476 |
@luomo-pro |
I was able to reproduce this with darshankawar's code with the "Touch Typing" setting in the Voice Over settings under "Typing". There is another option "Direct Touch Typing", but that one doesn't repro the problem. When using "Touch Typing", the framework is receiving a tap event (here) when the text field is tapped once, but in any other typing mode, no tap event is received. @jmagman Do you have any insight into how VoiceOver affects how Flutter receives touch events? If not then @chunhtai probably does, though he's on leave until next week. |
Hm, I've never looked into how that works. If @chunhtai doesn't have the bandwidth to dig into this soon, I'll see if I can get someone to debug this, particularly since it's reproducible (cc @vashworth who might be the person who gets pulled into this 🙂 ) |
Hi @jmagman |
Not sure on solution, but here's what I think is happening: Seems like when touch typing is on, I believe this is happening due to Flutter adding the According to Apple's documentation
So by treating Update: I confirmed that |
`UIAccessibilityTraitKeyboardKey` was added in #4575 so that `TextInputSemanticsObject` supported VoiceOver gestures for text editing features, such as pinch to select text, and up/down fling to move cursor. After experimenting with it, I found that those features were still available even after removing `UIAccessibilityTraitKeyboardKey`. Fixes flutter/flutter#94465. In Touch Typing Mode: https://github.com/flutter/engine/assets/15619084/ccfe90ff-d3bc-427b-b1aa-9ec1242c0c89 In Standard Typing Mode: https://github.com/flutter/engine/assets/15619084/c78b1fb0-0816-41fb-9dd5-ed8b8a4cda2d [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
When VoiceOver's typing mode is touch typing
When a finger touches the TextField and lets go, it will activate the TextField by mistake, causing the keyboard to pop up.
If you change VoiceOver's typing mode to standard typing, you won't have this problem.
But in native typing mode, no matter what type mode you touch the TextField and let go, the popup control is not activated unless the user manually double-clicks the screen.
Note: Steps for modifying different typing modes:
Since I don't speak English, I use a translator, so the description may not be completely accurate, if you have any questions, please comment!
This is my code snippet:
TextField(
decoration: InputDecoration(
labelText: "user name",
hintText: "user name or email",
prefixIcon: Icon(Icons.person)
)),
I use:
Flutter (Channel beta, 2.7.0-3.1.pre
The text was updated successfully, but these errors were encountered: