Skip to content

Revert: [web] Keep the keyboard up during an iOS caret drag - #190926

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
flutteractionsbot:revert-190014-1786461597
Aug 11, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
flutteractionsbot:revert-190014-1786461597

Conversation

@flutteractionsbot

Copy link
Copy Markdown
Contributor

Reverts: [web] Keep the keyboard up during an iOS caret drag

Initiated by: @jtmcdole

Reason for reverting:

Original PR Author: @flutter-zl

Reviewed By: @Renzo-Olivares

The original PR description is provided below:

Fixes #189744

Problem
On iOS 27, long-press-dragging the selection caret in a Web TextField dismisses the keyboard mid-gesture. WebKit transiently blurs the hidden input with a null relatedTarget while the document keeps focus, then refocuses it a frame later,and the engine reacted to that blink on two listeners that each tore the input down. A plain input ignores the same blur, so the cause is Flutter's reaction, not a WebKit limitation.

Fix
On iOS both listeners now defer their teardown by 100ms and cancel it if the input refocuses, mirroring the existing #155265 deferred close. Done and tap-away never refocus so they still close, and the deferral is narrowed to the exact drag signature so every other focus transition is unaffected.

Demo
Before: https://flutter-demo-52-before.web.app (keyboard dismisses mid caret drag)
After: https://flutter-demo-52-after.web.app (keyboard stays up)

Repro on iOS 27 Safari: tap the field to raise the keyboard, then long-press and drag the selection caret. Before dismisses; after stays up. Done and tap-away still dismiss.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 11, 2026
@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. platform-web Web applications specifically f: focus Focus traversal, gaining or losing focus team-web Owned by Web platform team labels Aug 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes the iOS Safari-specific transient blur deferral logic from ViewFocusBinding and DefaultTextEditingStrategy, along with associated timers, helper methods, and tests. I have no feedback to provide as there are no review comments.

@jtmcdole jtmcdole added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 11, 2026
Merged via the queue into flutter:master with commit 90cf7be Aug 11, 2026
26 of 27 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@flutteractionsbot
flutteractionsbot deleted the revert-190014-1786461597 branch August 11, 2026 18:22
pull Bot pushed a commit to edisplay/flutter that referenced this pull request Sep 18, 2026
…#190942)

Fixes flutter#189744

**Reland of flutter#190014, reverted in flutter#190926.**

Cause: three of the new tests dispatch a real input.blur(), but desktop
Safari uses SafariDesktopTextEditingStrategy, which does not subscribe
to blur, so handleBlur never ran. Real iOS does subscribe, so the fix
itself was unaffected.

Delta: one test-only commit adding skip: isSafari to those three tests.
No production change.

**Problem**
On iOS 27, long-press-dragging the selection caret in a Web TextField
dismisses the keyboard mid-gesture. WebKit transiently blurs the hidden
input with a null relatedTarget while the document keeps focus, then
refocuses it a frame later,and the engine reacted to that blink on two
listeners that each tore the input down. A plain input ignores the same
blur, so the cause is Flutter's reaction, not a WebKit limitation.

**Fix**
On iOS both listeners now defer their teardown by 100ms and cancel it if
the input refocuses, mirroring the existing
flutter#155265 deferred close. Done
and tap-away never refocus so they still close, and the deferral is
narrowed to the exact drag signature so every other focus transition is
unaffected.

**Demo**
Before: https://flutter-demo-52-before.web.app/ (keyboard dismisses mid
caret drag)
After: https://flutter-demo-52-after.web.app/ (keyboard stays up)

Repro on iOS 27 Safari: tap the field to raise the keyboard, then
long-press and drag the selection caret. Before dismisses; after stays
up. Done and tap-away still dismiss.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD engine flutter/engine related. See also e: labels. f: focus Focus traversal, gaining or losing focus platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web][iOS 27] Keyboard dismisses when long-press-dragging the text selection caret

2 participants