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

Reverts "Fix focus management for text fields (#51009)" #53502

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

auto-submit[bot]
Copy link
Contributor

@auto-submit auto-submit bot commented Jun 21, 2024

Reverts: #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
  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

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 and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

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

@auto-submit auto-submit bot added the revert of Bot Only: Tracking label for bot. Tracks new revert of pull requests. label Jun 21, 2024
@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jun 21, 2024
@auto-submit auto-submit bot merged commit cf3ac2d into main Jun 21, 2024
6 checks passed
@auto-submit auto-submit bot deleted the revert_87a632b43536cee9df3e17c59b86c2dff077fcee branch June 21, 2024 12:56
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 21, 2024
…150637)

flutter/engine@dda82d9...33415c6

2024-06-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 4483d67ba725 to fc1e5912fc94 (1 revision) (flutter/engine#53503)
2024-06-21 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix focus management for text fields (#51009)" (flutter/engine#53502)
2024-06-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 19d3e659f49a to 4483d67ba725 (2 revisions) (flutter/engine#53501)
2024-06-20 mdebbar@google.com [web] Add 'flt-semantics-identifier' attribute to semantics nodes (flutter/engine#53278)
2024-06-20 mdebbar@google.com [web] Don't add `href="#"` to semantics links (flutter/engine#53395)
2024-06-20 skia-flutter-autoroll@skia.org Roll Dart SDK from be6b533e07e7 to 19d3e659f49a (1 revision) (flutter/engine#53495)
2024-06-20 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from tD5pof7jVnbXPwP7l... to iU-B6rJxy0wUYSmmp... (flutter/engine#53493)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from tD5pof7jVnbX to iU-B6rJxy0wU

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ditman added a commit to ditman/flutter-engine that referenced this pull request Jun 24, 2024
auto-submit bot pushed a commit that referenced this pull request Jun 24, 2024
Relands: [**Fix focus management for text fields** (#51009)](#51009) by:

* Reverting commit: cf3ac2d (#53502).
* Keeping the new `ViewFocusBinding` disabled, as [suggested](#51009 (comment)).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
sigurdm pushed a commit to sigurdm/flutter that referenced this pull request Jun 26, 2024
…lutter#150637)

flutter/engine@dda82d9...33415c6

2024-06-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 4483d67ba725 to fc1e5912fc94 (1 revision) (flutter/engine#53503)
2024-06-21 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix focus management for text fields (flutter#51009)" (flutter/engine#53502)
2024-06-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 19d3e659f49a to 4483d67ba725 (2 revisions) (flutter/engine#53501)
2024-06-20 mdebbar@google.com [web] Add 'flt-semantics-identifier' attribute to semantics nodes (flutter/engine#53278)
2024-06-20 mdebbar@google.com [web] Don't add `href="#"` to semantics links (flutter/engine#53395)
2024-06-20 skia-flutter-autoroll@skia.org Roll Dart SDK from be6b533e07e7 to 19d3e659f49a (1 revision) (flutter/engine#53495)
2024-06-20 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from tD5pof7jVnbXPwP7l... to iU-B6rJxy0wUYSmmp... (flutter/engine#53493)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from tD5pof7jVnbX to iU-B6rJxy0wU

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-web Code specifically for the web engine revert of Bot Only: Tracking label for bot. Tracks new revert of pull requests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants