Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@nturgut
Copy link
Contributor

@nturgut nturgut commented Jun 2, 2020

Do not close the text editing connection when an input text element is blurred (upon clicking another element on the page) on a desktop browser. Keep the current behavior for mobile browsers.

This change is requested on many issues:
flutter/flutter#49785
flutter/flutter#55042
flutter/flutter#55449

The features which expect the following behavior will be negatively effected:
(1) User enters text to a TextFormField-A
(2) User clicks on another item Element-B (or jumps to next field using tab)
(3) The onFieldSubmitted on TextFormField-A will trigger, since the editing of the field is finished.
The keyboard keys (Enter, Tab) will still trigger onFieldSubmitted.

Tested on: Chrome Desktop, Firefox, Safari Desktop.
Manually tested for a11y on Chrome Desktop.

nturgut added 2 commits June 1, 2020 23:01
…s blurred (upon clicking another element on the page) on a desktop browser. keep the current behaviour for mobile browsers
@nturgut nturgut requested a review from mdebbar June 2, 2020 17:16
Comment on lines 623 to 631
_subscriptions.add(domElement.onBlur.listen((_) {
if (domRenderer.windowHasFocus) {
// Focus is still on the body. Continue with blur.
owner.sendTextConnectionClosedToFrameworkIfAny();
} else {
// Refocus.
domElement.focus();
}
}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in chat, we need to refocus on blur in order for the keyboard to continue to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. thanks for catching this!

@nturgut nturgut requested a review from mdebbar June 2, 2020 19:11
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

LGTM

…firefox in the automated test. manually checks working
@nturgut
Copy link
Contributor Author

nturgut commented Jun 3, 2020

Linux Fuchsia bot has ended with infra error, the status is not synced back to github.

@nturgut
Copy link
Contributor Author

nturgut commented Jun 3, 2020

Also Mac Engine Drone, Mac Android Debug Engine also failed with infra failures. Results are not updated to github.

All these three tests are not related to current changes path. Current change only effects Flutter Web Engine. Merging the PR.

@nturgut nturgut merged commit 895ef33 into flutter:master Jun 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 5, 2020
stevenmetzger added a commit to stevenmetzger/engine that referenced this pull request Nov 14, 2020
* Previously, Flutter for Web behaved like a web page. If user clicked on an
  area other than the input field itself, the input field was blurred, thus
  the connection is closed.
  This behavior was changed for Desktop Browsers.
  flutter#18743

  Now only, pressing enter or tab changes the focus of the input fields.

  This created a regression for applications that relied on the old behavior
  flutter/flutter#64245

* This change adds a flag which will provides a workaround to the
  regression allowing developers to optionally force the connection
  to close on blur, as suggested in the comments
  flutter/flutter#64245 (comment)
@opheliagame
Copy link

opheliagame commented Oct 23, 2023

coming here from flutter/flutter#55449 and wondering what the current approach would be to resolving the issue on mobile browsers. The example mentioned in the issue doesn't seem to work for me on a desktop browser as well, does this happen for other people too?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants