-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Remove connection close on blur for desktop browsers #18743
[web] Remove connection close on blur for desktop browsers #18743
Conversation
…s blurred (upon clicking another element on the page) on a desktop browser. keep the current behaviour for mobile browsers
| _subscriptions.add(domElement.onBlur.listen((_) { | ||
| if (domRenderer.windowHasFocus) { | ||
| // Focus is still on the body. Continue with blur. | ||
| owner.sendTextConnectionClosedToFrameworkIfAny(); | ||
| } else { | ||
| // Refocus. | ||
| domElement.focus(); | ||
| } | ||
| })); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
mdebbar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…firefox in the automated test. manually checks working
|
Linux Fuchsia bot has ended with infra error, the status is not synced back to github. |
|
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. |
* 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)
|
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? |

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.