Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unifies text field focus management in desktops #129652

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Jun 27, 2023

related #128709

engine PR: flutter/engine#43279

The web engine requires a way to unfocus textfield, It comes to nature to me that we should leverage didGain/didLose a11y focus action. I also unifies the action handler of all desktop platforms

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.

@chunhtai chunhtai requested review from yjbanov and mdebbar June 27, 2023 19:02
@chunhtai chunhtai added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Jun 27, 2023
@goderbauer goderbauer added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jul 5, 2023
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems and removed a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) labels Jul 7, 2023
@chunhtai
Copy link
Contributor Author

chunhtai commented Jul 7, 2023

IMG_0001.MOV

Tested with ios web, looks normal

@@ -1313,6 +1314,11 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
_effectiveFocusNode.requestFocus();
}
};
handleDidLoseAccessibilityFocus = () {
if (_effectiveFocusNode.hasFocus) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check is not necessary. FocusNode already checks for hasFocus and a couple of other things.

}
};
handleDidLoseAccessibilityFocus = () {
if (_effectiveFocusNode.hasFocus) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -1344,6 +1361,11 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
_effectiveFocusNode.requestFocus();
}
};
handleDidLoseAccessibilityFocus = () {
if (_effectiveFocusNode.hasFocus) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 12, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 12, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jul 12, 2023

auto label is removed for flutter/flutter, pr: 129652, due to - The status or check suite Linux firebase_oriol33_abstract_method_smoke_test has failed. Please fix the issues identified (or deflake) before re-applying this label.

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 12, 2023
@CaseyHillers
Copy link
Contributor

Google testing is stuck as pending due to the test results being cleaned up. The latest results passed the smoke test, so this is safe to land.

There's an internal breakage where we're unable to override the GitHub status (b/291100012)

@chunhtai chunhtai merged commit 2e8af2c into flutter:master Jul 13, 2023
72 of 73 checks passed
@chunhtai
Copy link
Contributor Author

Manually landed the pr as google test can't be overridden

auto-submit bot pushed a commit to flutter/engine that referenced this pull request Jul 13, 2023
…ion (#43279)

fixes flutter/flutter#128709

requires flutter/flutter#129652

The issue is that when textfield focus in framework and web engine a11y are out of sync, the framework keep sending update with textfield focus = true and causes web engine to keep refocusing the textfield.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 13, 2023
related flutter#128709

engine PR: flutter/engine#43279

The web engine requires a way to unfocus textfield, It comes to nature
to me that we should leverage didGain/didLose a11y focus action. I also
unifies the action handler of all desktop platforms

## 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].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 14, 2023
kjlubick pushed a commit to kjlubick/engine that referenced this pull request Jul 14, 2023
…ion (flutter#43279)

fixes flutter/flutter#128709

requires flutter/flutter#129652

The issue is that when textfield focus in framework and web engine a11y are out of sync, the framework keep sending update with textfield focus = true and causes web engine to keep refocusing the textfield.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2023
harryterkelsen pushed a commit to harryterkelsen/engine that referenced this pull request Jul 20, 2023
…ion (flutter#43279)

fixes flutter/flutter#128709

requires flutter/flutter#129652

The issue is that when textfield focus in framework and web engine a11y are out of sync, the framework keep sending update with textfield focus = true and causes web engine to keep refocusing the textfield.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
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 autosubmit Merge PR when tree becomes green via auto submit App 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.

None yet

4 participants