Skip to content

fix(wasm): Keep the hidden TextBox input off-screen on iOS (backport #24527) - #24580

Merged
ajpinedam merged 13 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24527
Sep 22, 2026
Merged

ajpinedam merged 13 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24527

Conversation

@mergify

@mergify mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #24526

PR Type:

🐞 Bugfix

What changed? 🚀

Current behavior. On the Skia WebAssembly head in iPad/iPhone Safari (and any iOS browser, all WebKit), focusing a TextBox that sits near or under the soft keyboard can shift the whole application up: WebKit scrolls the page into the keyboard inset to reveal the focused editable. The page is position:fixed so nothing else can move, and the shift is not undone until focus is lost. While the page is shifted, clientX/Y (viewport-relative in Safari) no longer match the canvas, so every tap lands pan pixels away from what the user sees: tapping a second TextBox focuses something else and closes the keyboard, and one-finger drags inside a ScrollViewer pan the page instead of scrolling the content. The internal InputPane bring-into-view (#23890) and WebKit's reveal also fight each other, so the focused field bobs in and out from under the keyboard.

WebKit has two reveal paths (from WKWebViewIOS.mm / WKContentViewInteraction.mm):

  • on focus, _zoomToRevealFocusedElement (deferred to keyboard-will-show; centers the element when it is within 50pt of the keyboard) — this one honors focus({ preventScroll: true });
  • on every keyboard frame change (two-step keyboard show on device, predictive bar, layout switches), _scrollToAndRevealSelectionIfNeeded scrolls by exactly caretBottom + 4 − visibleHeight when the caret was visible before the change — this one ignores preventScroll.

Both need an on-screen caret rect to act on. Uno's TextBox draws its own caret, selection, touch grippers and selection flyout, so the shared invisible #uno-input only has to exist and be focused; its position on iOS is not used for anything the user can see.

New behavior.

  • On iOS/iPadOS (navigator.platform iP*, or MacIntel with maxTouchPoints > 1 for iPadOS 13+), #uno-input is created with top: -10000px (left stays 0 so a right-to-left document gains no scrollable overflow) and updatePosition / updateSize become no-ops there: a multi-line TextBox reports its full content height, which would otherwise stretch the input back into the viewport. WebKit finds nothing to reveal, the visual viewport never pans, and pointer coordinates stay aligned with the canvas. Other platforms keep the input placed and sized over the TextBox (desktop IME candidate windows anchor to it). The active policy is exposed as data-uno-placement="offscreen|tracking" on the input for Web Inspector diagnosis.
  • focus() is called with { preventScroll: true } on both the retarget and the swap paths, on every platform: the InputPane drives bring-into-view, the browser's scroll-to-focus is never wanted.
  • SoftKeyboardFocusTests manual sample gains a side-panel ScrollViewer (Title, numeric AutoNumber, dates, multiline notes, ten fields) with a focused-field/panel-offset readout, mirroring the customer layout. Items 4–5 also reproduce in the iOS Simulator (toggle I/O > Keyboard > Connect Hardware Keyboard to force a keyboard frame change).
  • New Skia WASM runtime test Given_TextBox.When_Focused_In_Browser_Then_Hidden_Input_Placement_Matches_Host pins the placement policy on whichever browser hosts the suite. It derives the expected policy from the host rather than from what the page reports, then asserts the matching geometry: tracking means the input's rendered rect sits inside the TextBox and follows it when it moves; offscreen means the rect stays entirely above the viewport across the same move. A missing input fails both branches.

Validation.

  • iPad Pro 11" simulators (iOS 18.6 and 26.0), Skia WASM SamplesApp served over LAN, driven from the session. The pan was reproduced deterministically on the baseline by parking the input under the keyboard and changing the keyboard frame (Simulator hardware-keyboard toggle): page scrolls 125px, vv.offsetTop == scrollY == 125, a tap at the checkbox's visual position reports clientY=123 / pageY=498 and toggles a control 375px away.
  • Alternatives measured on the same trigger: preventScroll alone still pans 125px; scrollTo(0,0) counter-pan leaves a 3–8px visual-viewport offset JS cannot clear; line-height:0 is ignored on <input>; width/height:0 still pans (caret rect is not clipped); font-size:0 works but risks the 16/fontSize focus zoom on iPhone; off-screen input: no pan, keyboard opens, typing works.
  • With the fix (iOS 18.6 and 26.0 simulators): fresh focus opens the keyboard with the input off-screen, the same keyboard frame change no longer pans (visualViewport.offsetTop stays 0), typing reaches the TextBox, tapping a neighbouring TextBox keeps the keyboard open, dragging inside a ScrollViewer scrolls it. Control run with the input forced back on-screen still pans.
  • Given_TextBox.When_Focused_In_Browser_Then_Hidden_Input_Placement_Matches_Host passes on the Skia WASM head in headless Chrome, which exercises the tracking branch. The offscreen branch runs the first time the suite is hosted on an iOS browser.
  • Not yet validated on a real iPad; the reporter is asked to re-test the side-panel scenario with the updated sample.

PR Checklist ✅


This is an automatic backport of pull request #24527 done by [Mergify](https://mergify.com).

@github-actions github-actions Bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/automation Categorizes an issue or PR as relevant to project automation labels Sep 21, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 234815 did not find any UI Test snapshots differences.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 234815 has failed on Uno.UI - CI.

@ajpinedam

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 235076 did not find any UI Test snapshots differences.

@ajpinedam
ajpinedam enabled auto-merge September 22, 2026 19:52
@ajpinedam
ajpinedam merged commit 25c176f into servicing/6.8 Sep 22, 2026
44 of 45 checks passed
@ajpinedam
ajpinedam deleted the mergify/bp/servicing/6.8/pr-24527 branch September 22, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants