Skip to content

Conversation

@wyqlxf
Copy link
Contributor

@wyqlxf wyqlxf commented May 10, 2024

This PR attempts to fix #127597

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels May 10, 2024
@wyqlxf wyqlxf changed the title Fix the second TextFormField to trigger onTapOutside Fix the second TextFormField to trigger onTapOutside May 10, 2024
@goderbauer goderbauer requested a review from gspencergoog May 10, 2024 21:04
@gspencergoog
Copy link
Contributor

Unfortunately, I think your change is not going to solve the problem without making more problems.
If you look at the failing tests, there are a number of cases where your change breaks existing scenarios.

One of the main reasons that TapRegion exists is so that we can bind widgets together into groups that don't trigger loss of focus. For instance, if you want to add formatting (bold, italic, etc.) buttons to a text field, but don't want clicking on those buttons to unfocus the text field, then you wrap them in a TextFieldTapRegion, which uses the same tap groupId as all of the text fields do, which is just the EditableText Type object itself.

Hope is not lost, though: To fix the problem you have, you'll need to figure out a way to give each text field a separate tap region groupId object that doesn't break the existing use cases. Perhaps a parameter on TextField that lets you supply the groupId object to EditableText, which overrides the default of EditableText?

@wyqlxf
Copy link
Contributor Author

wyqlxf commented May 11, 2024

@gspencergoog Thank you for your reply, your suggestions are great!

@github-actions github-actions bot added the f: material design flutter/packages/flutter/material repository. label May 11, 2024
@wyqlxf wyqlxf closed this May 13, 2024
@wyqlxf wyqlxf deleted the fix_127597 branch May 13, 2024 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After inputting text into a textFormField tapping into a second TextFormField does not trigger onTapOutside

2 participants