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

Flutter iOS Interactive Keyboard: Fixing Animation Issue #44514

Merged
merged 3 commits into from
Aug 9, 2023

Conversation

Matt2D
Copy link
Contributor

@Matt2D Matt2D commented Aug 8, 2023

This PR addresses an issue with the animation of the keyboard. In iOS 16.0 a delay was included in UIView becomeFirstResponder where the areAnimationsEnabled boolean is no longer immediately read. In response to this issue a delay is added that allows for the animation to be properly disabled.

Design Document:
https://docs.google.com/document/d/1-T7_0mSkXzPaWxveeypIzzzAdyo-EEuP5V84161foL4/edit?pli=1

Issues Address:
flutter/flutter#57609

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 Hixie said 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.

@Matt2D Matt2D requested review from cbracken and hellohuanlin August 8, 2023 21:16
@Matt2D Matt2D marked this pull request as ready for review August 8, 2023 21:33
[self dismissKeyboardScreenshot];
// UIKit does not immediately access the areAnimationsEnabled Boolean so a delay is needed before
// returned
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
Copy link
Member

@cbracken cbracken Aug 8, 2023

Choose a reason for hiding this comment

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

We should extract a constant and use that here:

// Detailed explanation of why this is necessary.
constexpr int64_t kKeyboardAnimationDelayNs = 0.1 * NSEC_PER_SEC;

// Alternatively a detailed explanation here and...
static const NSTimeInterval kKeyboardAnimationDelaySeconds = 0.1;

// ... then use (int64_t)kKeyboardAnimationDelaySeconds * NSEC_PER_SEC in the dispatch_time call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely! Just added.

@@ -21,6 +21,10 @@
// it is activated.
static constexpr double kUITextInputAccessibilityEnablingDelaySeconds = 0.5;

// A delay before reenabling the UIView areAnimationsEnabled to YES
// in order for becomeFirstResponder to recieve the proper value
Copy link

Choose a reason for hiding this comment

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

Suggested change
// in order for becomeFirstResponder to recieve the proper value
// in order for becomeFirstResponder to receive the proper value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! Those will slip by me from time to time.

@Matt2D Matt2D requested a review from cbracken August 9, 2023 16:57
Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

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

LGTM!

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 9, 2023
@auto-submit auto-submit bot merged commit 7bcf9f4 into flutter:main Aug 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 9, 2023
zanderso pushed a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 10, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 10, 2023
…132284)

flutter/engine@b5b41ff...9117ff2

2023-08-10 zanderso@users.noreply.github.com Revert "Android a11y bridge sets importantness" (flutter/engine#44569)
2023-08-10 skia-flutter-autoroll@skia.org Roll Skia from 491f67637e6e to 7c5f6b17a998 (2 revisions) (flutter/engine#44568)
2023-08-10 matanlurey@users.noreply.github.com [Impeller] Replace Vulkan rotation checks with polling (flutter/engine#44361)
2023-08-10 31859944+LongCatIsLooong@users.noreply.github.com Disable text rounding hack by default (flutter/engine#44544)
2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 3d5a6138b7e5 to 491f67637e6e (4 revisions) (flutter/engine#44563)
2023-08-09 skia-flutter-autoroll@skia.org Manual roll Dart SDK from f664f4b9c50d to d89e4ead966d (11 revisions) (flutter/engine#44560)
2023-08-09 58529443+srujzs@users.noreply.github.com Make toJS'd function use JS types (flutter/engine#44469)
2023-08-09 xty50337@hotmail.com [web] Fix rendering of gradients in html mode (flutter/engine#40345)
2023-08-09 55360120+Matt2D@users.noreply.github.com Flutter iOS Interactive Keyboard: Fixing Animation Issue (flutter/engine#44514)
2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 8c9a8d3e073c to 3d5a6138b7e5 (4 revisions) (flutter/engine#44557)
2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from d210bab77137 to 8c9a8d3e073c (1 revision) (flutter/engine#44555)
2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 25aedb939915 to d210bab77137 (2 revisions) (flutter/engine#44550)
2023-08-09 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from e7bMhkfY-RPMrSMhB... to zoCGnScKZWbm5s9Hy... (flutter/engine#44548)
2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 17ba2122707b to 25aedb939915 (3 revisions) (flutter/engine#44547)
2023-08-09 47866232+chunhtai@users.noreply.github.com Android a11y bridge sets importantness (flutter/engine#44452)
2023-08-09 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from tO6r8iQqnmsYkLcvZ... to ZCP8LDbKF4LTBFz_W... (flutter/engine#44545)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from tO6r8iQqnmsY to ZCP8LDbKF4LT
  fuchsia/sdk/core/mac-amd64 from e7bMhkfY-RPM to zoCGnScKZWbm

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 chinmaygarde@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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

woohoo - sorry; meant to hit lgtm on my last review but posted as a comment instead. LGTM!

gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
This PR addresses an issue with the animation of the keyboard. In iOS 16.0 a delay was included in UIView becomeFirstResponder where the areAnimationsEnabled boolean is no longer immediately read. In response to this issue a delay is added that allows for the animation to be properly disabled. 

Design Document:
https://docs.google.com/document/d/1-T7_0mSkXzPaWxveeypIzzzAdyo-EEuP5V84161foL4/edit?pli=1

Issues Address:
flutter/flutter#57609

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
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-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants