-
Notifications
You must be signed in to change notification settings - Fork 6k
TextFormField does not get blurred when tapped outside of the widget. #22517
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
1 similar comment
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
@googlebot I fixed it. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
cc @yjbanov |
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.
Thanks for the contribution @stevenmetzger! Overall, this PR looks good.
I'm assuming there'll be a PR for the framework side too? If you can create a framework PR, that would be great so we can review (and submit) them both together.
| if (domElementIsActive && _inputConfiguration.forceCloseConnectionOnBlur) { | ||
| owner.sendTextConnectionClosedToFrameworkIfAny(); | ||
| } else { | ||
| 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.
This code has changed in 2948fee#diff-bd1a19d2674a1ef5a2a2541853d7c2d815acbdd2255b1edf6611486b52811dbe. Could you please rebase?
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.
Thanks for the feedback @mdebbar. Yes, I have created a PR for the framework side too. flutter/flutter#74354. Sorry I didn't include this in the first place, I wasn't sure what the best practice was for changes that touch multiple projects.
I have rebased the change.
* Add optional argument (forceCloseConnectionOnBlur) to TextField * This PR is meant to accompany this change to flutter/engine flutter/engine#22517
* Add optional argument (forceSubmitOnFocusLost) to TextField * This PR is meant to accompany this change to flutter/engine flutter/engine#22517
|
@mdebbar is this on your radar? |
|
The framework companion of this PR was closed due to inactivity. I'm closing this one too. @stevenmetzger feel free to re-open and update the PRs. |
Description
This PR addresses flutter/flutter#64245
TextFormField does not get blurred when tapped outside of the widget.
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.
[web] Remove connection close on blur for desktop browsers #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
[web] TextFormField does not get blurred when tapped outside of the widget. 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
[web] TextFormField does not get blurred when tapped outside of the widget. flutter#64245 (comment)
Related Issues
#18743
flutter/flutter#64245
flutter/flutter#64245 (comment)
Tests
I added the following tests:
A second test that verifies the same behaviour that existed prior to the regression in the case where the optional argument to use that old behaviour is included.
Because I didn't change the default behaviour I left the original test unchanged.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.