-
Notifications
You must be signed in to change notification settings - Fork 6k
Add focus support for platform view #33093
Add focus support for platform view #33093
Conversation
0df0bcf
to
1519063
Compare
1b606bd
to
7372ec3
Compare
shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm
Outdated
Show resolved
Hide resolved
// Caveat: | ||
// 1. This detection logic does not cover the scenario when a platform view becomes | ||
// first responder without any flutter text input resigning its first responder status | ||
// (e.g. user tapping on platform view first). For now it works fine because there can only be |
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.
Just curious:
Are we expecting an UIKit update that will introduce multiple first responders?
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.
I should probably rephrase it clearly - I am not expecting UIKit change. What I meant to say is that right now the text input plugin does not need to keep track of the platform view focus state, but in the future we may need to track it (not because of UIKit change, but for potential other unknown reasons)
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
- (void)setPlatformViewTextInputClient:(long)platformViewID { | ||
// No need to track the platformViewID for now (unlike in Android), because in iOS there can | ||
// only be one single first responder. When a platform view becomes first responder, hide | ||
// this dummy text input view (`_activeView`) for the previously focused widget. | ||
[self removeEnableFlutterTextInputViewAccessibilityTimer]; | ||
_activeView.accessibilityEnabled = NO; | ||
[_activeView removeFromSuperview]; | ||
[_inputHider removeFromSuperview]; | ||
} | ||
|
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 looks fine to me.
cc @justinmc, do you mind take a quick look at this to see if it makes sense?
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.
@justinmc could you take a quick look? thanks
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.
im gonna land it first since i've tested it many times, and it's not used just yet (until the framework part is complete), but let me know if any thing comes up
shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm
Outdated
Show resolved
Hide resolved
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.
LGTM % nits
e66b307
to
26d1faf
Compare
This pull request is not suitable for automatic merging in its current state.
|
This PR continues the work to add Focus support for platform view. It mainly contains 2 parts:
I wrote up this proposal to provide more context such as different approaches to detect first responder events.
List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#34187
The previous PR in framework repo is here
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.