Skip to content

Commit

Permalink
Implement _suspendedNode fix (flutter#143556)
Browse files Browse the repository at this point in the history
Previously we merged flutter#142930, to solve issue flutter#87061.

Since then, I discovered that the keyboard input wasn't being captured after the app had been paused and resumed. After some digging, I realized that the problem was due to [a line in editable_text.dart](https://github.com/flutter/flutter/blob/d4b1b6e744ba6196e14fb49904f07a4aea4d5869/packages/flutter/lib/src/widgets/editable_text.dart#L3589) that called the `focusNode.consumeKeyboardToken()` method.

Luckily, it's a very easy fix: we just use `requestFocus()` instead of `applyFocusChangesIfNeeded()`. @gspencergoog could you take a look when you have a chance?
  • Loading branch information
nate-thegrate committed Feb 20, 2024
1 parent 6707f5e commit fc07b24
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/flutter/lib/src/widgets/focus_manager.dart
Expand Up @@ -1711,10 +1711,9 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
_suspendedNode = null;
}
else if (_suspendedNode != null) {
assert(_focusDebug(() => 'marking node $_suspendedNode to be focused'));
_markedForFocus = _suspendedNode;
assert(_focusDebug(() => 'requesting focus for $_suspendedNode'));
_suspendedNode!.requestFocus();
_suspendedNode = null;
applyFocusChangesIfNeeded();
}
} else if (_primaryFocus != rootScope) {
assert(_focusDebug(() => 'suspending $_primaryFocus'));
Expand Down

0 comments on commit fc07b24

Please sign in to comment.