Skip to content

fix(ios): make the web view first responder before autofocusing - #789

Merged
dcalhoun merged 1 commit into
trunkfrom
fix/ios-27-title-autofocus
Oct 14, 2026
Merged

dcalhoun merged 1 commit into
trunkfrom
fix/ios-27-title-autofocus

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What?

Fix broken post title auto-focus for empty posts on iOS.

Why?

Auto-focus allows quick typing for new posts. The broken state originates to changes from iOS 27.

How?

Ensure the web view is the first responder before auto-focusing.

Testing Instructions

  1. Open an empty editor in the iOS demo app on iOS 27
  2. Verify the post title is auto-focused

Accessibility Testing Instructions

N/A, no navigation changes.

Screenshots or screencast

N/A, no visual changes.


AI-generated details

Problem: On iOS 27, opening the editor for a new, empty post leaves the title without a caret or keyboard. iOS 26 and Android are unaffected.

Cause: The title already has DOM focus, but the web view is not first responder (document.hasFocus() is false) when editor.focus() runs. iOS 27 no longer promotes the web view to first responder for script-driven focus, so no input session starts.

Fix: EditorViewController.focus(force:) calls webView.becomeFirstResponder() before editor.focus().

Verified on the iOS 27 simulator via the demo app:

  • New empty post: caret in the title and keyboard shown.
  • Forced Lockdown Mode (isLockdownModeEnabled = true on the web view config): the sheet presents without a keyboard; autofocus stays skipped.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EStq5uGvLgsu7tD3iAKJcT

iOS 27 no longer gives the web view first responder status when script focuses an element, so the title gained DOM focus without an input session and the keyboard never appeared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EStq5uGvLgsu7tD3iAKJcT
@dcalhoun dcalhoun added the iOS label Oct 14, 2026
@github-actions github-actions Bot added the [Type] Bug An existing feature does not function as intended label Oct 14, 2026
@wpmobilebot

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/789")

Built from 8cac1d4

@dcalhoun
dcalhoun marked this pull request as ready for review October 14, 2026 18:24
@dcalhoun
dcalhoun requested a review from crazytonyli October 14, 2026 18:24
@dcalhoun
dcalhoun merged commit b188e4d into trunk Oct 14, 2026
27 checks passed
@dcalhoun
dcalhoun deleted the fix/ios-27-title-autofocus branch October 14, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

iOS [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants