Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@htoor3
Copy link
Contributor

@htoor3 htoor3 commented Nov 10, 2023

In order to fix Safari autofill, we've had to give inactive elements non-zero size because Safari does not respect offscreen or 0-sized inputs, and this leads to broken autofill behavior (see: #43058).

As part of these changes, we needed to disable pointer events for the parent <form> element so that we don't have pointer event collisions if users hover over or click into the invisible autofill elements within that form.

This led to an issue where offsets weren't being calculated correctly for "active" inputs because they relied on pointer events bubbling up and being caught by the form. The fix is to explicitly set pointer events on the active inputs, so that we can correctly discern when our pointer event target is actually the input and correctly calculate the offsets.

Fixes flutter/flutter#136006

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.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Nov 10, 2023
@htoor3 htoor3 requested a review from mdebbar November 10, 2023 18:36
// order to calculate the correct pointer event offsets.
// See: https://github.com/flutter/flutter/issues/136006
if(textEditing.strategy is SafariDesktopTextEditingStrategy) {
mainTextEditingElement.style.pointerEvents = 'all';
Copy link
Contributor

Choose a reason for hiding this comment

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

I have two questions here:

  1. Do we need to set this back to none after the input loses focus?
  2. Should we preemptively set pointer-events: all for all inputs in EngineAutofillForm.fromFrameworkMessage()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. We only need to ensure that it remains none if it remains on the screen and another input on the form is focused. This is being automatically handled for us in fromFrameworkMessage inside EngineAutofillForm. This happens when we click any other input in the form. The other case where it loses focus is where we just click anywhere outside of the input and the form. In this case, the input gets moved offscreen so we don't have to worry about it.
  2. We can't do this because of the Safari autofill fix where we need all the non-active inputs to be on screen but hidden from the user. We actually preemptively disable pointer events for non active inputs in EngineAutofillForm.fromFrameworkMessage() so that we don't have pointer collisions if users inadvertently hover/click over those hidden inputs

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay that makes sense. Thanks for explaining this!

@htoor3 htoor3 requested a review from mdebbar November 13, 2023 17:08
// order to calculate the correct pointer event offsets.
// See: https://github.com/flutter/flutter/issues/136006
if(textEditing.strategy is SafariDesktopTextEditingStrategy) {
mainTextEditingElement.style.pointerEvents = 'all';
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay that makes sense. Thanks for explaining this!

@htoor3 htoor3 added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2023
@auto-submit auto-submit bot merged commit 6b2de88 into flutter:main Nov 13, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 13, 2023
…138375)

flutter/engine@db6da00...046ec85

2023-11-13 [email protected] Fix fuchsia upload symbols. (flutter/engine#47938)
2023-11-13 [email protected] Roll Skia from 1a39bd56cda2 to 9ac5cad143ec (3 revisions) (flutter/engine#47984)
2023-11-13 [email protected] [web] - fix Safari textfield selection bug (flutter/engine#47917)
2023-11-13 [email protected] Roll Skia from 17b6555a1551 to 1a39bd56cda2 (2 revisions) (flutter/engine#47980)
2023-11-13 [email protected] Add a libcxxabi module that provides support for C++ thread-local storage (flutter/engine#47886)

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 [email protected],[email protected],[email protected] 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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Web] Textfield selection doesn't work correctly in Safari

2 participants