forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverts "Fix focus management for text fields (flutter#51009)" (flutt…
…er#53502) Reverts: flutter#51009 Initiated by: jiahaog Reason for reverting: This causes b/348598454. We're getting test failures with stack traces like the following after this PR: ``` Cannot get renderObject of inactive element. In order for an element to have a valid renderObject, it must be active, which means it is part of the tree. Instead, this element is in the _ElementLifecycle.inactive state. If you called this method from a State object, consider guarding ``` Original PR Author: tugorez Reviewed By: {mdebbar} This change reverts the following previous change: Fix focus management for text fields This PR: 1. Refactors the DOM `focus` function to take [options][1] 2. Removes the timers sorrounding the `activeDomElement.focus()` so that the input elements get focused as immediate as possible. 3. Prevents the default on pointerdown in a Flutter View and schedules a `requestViewFocusChange` to claim focus in that view after some time. This gives `2` the opportunity to focus the right `<input />` or `<textarea />` element. This helps focus correctly transition from one input element to another (without jumping to a flutter view in between). 4. Deactivating a `TextField` doesn't blur the focused element anymore, it insteads schedules for later a call to move the focus to the flutter view if nothing inside it claimed focus first. 5. Prevents scroll in all the focus calls (this should help with the view jumping when focusing one text field after another). ## Sample apps 1. Full screen mode: https://tugorez.com/flutter_focus_web 2. Embedded mode: https://tugorez.com/flutter_focus_web?embedded [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
- Loading branch information
1 parent
328a08b
commit cf3ac2d
Showing
6 changed files
with
254 additions
and
251 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
Oops, something went wrong.