-
Notifications
You must be signed in to change notification settings - Fork 30.6k
[ios][engine] Fix autofill context cleanup and view lifecycle management #173598
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
05c2779
fix: Fix autofill context cleanup and view lifecycle management
koji-1009 5af6987
refactor: Simplify dealloc method
koji-1009 cb60fe1
Merge branch 'master' into fix/autofill_context
koji-1009 20a9e29
Merge branch 'master' into fix/autofill_context
LongCatIsLooong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm hoping we can just remove these (at least the timer).
Per @chunhtai (if I recall correctly) this is for cases like navigating to a new route with an "autofocus: true" text field. But I think when that happens, the accessibility bridge would have already received the new semantics tree, especially with the current implementation where
autofocusis scheduled in a post frame callback and semantics updates are sent synchronously to the accessibility bridge on iOS.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.
@chunhtai do you think this can be removed?
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.
Also, if we're worried about the timing with the semantics tree update, shouldn't accessibility bridge be the one that calls
enableActiveViewAccessbilitywhen it's ready, instead of the text input plugin tries to coordinate with the accessibility bridge?Uh oh!
There was an error while loading. Please reload this page.
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.
The current implementation was five years ago bf551a3.
Where this changed was introduced 4 years ago d2dacb3
I am not sure if this is still needed either though.
This is only an issue due to iOS internal implementation that it reuses UItextinput for text editing and a11y tree. From the framework perspective, there is nothing wrong that autofocus the textfield and then sends a11y tree update. The keyboard focus and a11y focus are separated concepts in the first place.
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.
Is removing this delay necessary for autofill to work?
Uh oh!
There was an error while loading. Please reload this page.
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 would think not (it's more of a drive-by comment).
Yeah the framework doesn't have to know about the details of what UIKit / the text input plugin does, but the iOS accessibility bridge is specialized for the iOS implementation, and to me it seems to be the perfect place to determining when to switch between an a11y node and the "real" input field (instead of using a timer in TextInputPlugin). But again I digress.
IIRC the PR moves the switch code from
show/hidetosetInputClient/clearInputClient, so the timing is a bit different and the app may callshow/hidethemselves to dismiss / reveal the virtual keyboard. Do you happen to know if that will break anything, or are there things we should test to make sure there's no regression.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.
Oh I misread the original question, yeah moving this to ios a11ybridge is fine. It just feels a bit weird that a11y needs to listen to textinputplugin activation and then set the attribute on textinputplugin, but I get it makes a bit more sense to structure the code this way
I think this is probably fine. to do a manual test just create a push a new route with autofocus textfield in voice over and see if you will see weird focus behavior
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.
Sounds good I'll give that a try.
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.
(trying the implementation out now).
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 tried out the patch and the behavior seems to be exactly the same in my test app:
The only weirdness I observed: when I press the "123" button and wait for the route transition to finish, the accessibility focus indicator (the rectangle with black borders) would sometimes show over an empty area with no interactive UI elements and announce "one hundred and twenty three". I'm seeing that with and without this patch so I guess that's not related.