Skip to content

fix(wasm): Size the invisible text input to the content area (backport #24556) - #24579

Merged
ajpinedam merged 6 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24556
Sep 23, 2026
Merged

ajpinedam merged 6 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24556

Conversation

@mergify

@mergify mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: Tracked internally.

PR Type:

🐞 Bugfix

What changed? 🚀

The invisible <input /> the WASM head keeps in the DOM for text entry was sized and positioned from TextBoxView.DisplayBlock. The DisplayBlock shrink-wraps the text, so the element tracked the text rather than the field.

This was latent for a long time, because the TS wrote a unitless value:

input.style.width = `${width}`;    // invalid CSS, silently dropped

Once the unit was added, the sizing took effect and the element started growing by a character's width on every keystroke. Browser password managers bind to that <input /> (it carries type="password" and autocomplete="password") and anchor their affordances to its bounds — so the badge sat at the left edge of an empty PasswordBox and marched right as the user typed.

UpdateSize and UpdatePosition now track the ContentElement minus its padding, which is what OverlayTextBoxViewExtension already does on the other Skia targets. Moving the position to the same anchor keeps the element on its field when long text scrolls horizontally or TextAlignment shifts the DisplayBlock.

Adding the CSS unit was correct and is left as-is — it only exposed this.

Verification

Measured the real #uno-input bounds in Chrome against SamplesApp's search TextBox, typing 10 characters. Identical builds, only this change differing:

characters typed before after
0 1px 216px
1 12px 184px
5 56px 184px
10 110px (+11px/char) 184px (flat)

The one-time 216 → 184 step after the first character is the DeleteButton appearing on the focused non-empty TextBox, which genuinely narrows the ContentElement. It happens once, not per character.

The added runtime test was confirmed to fail without the fix (expected value <182> and actual value <1>) and pass with it.

PR Checklist ✅

🤖 Generated with Claude Code


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

@mergify

mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of bdbb268 has failed:

On branch mergify/bp/servicing/6.8/pr-24556
Your branch is up to date with 'origin/servicing/6.8'.

You are currently cherry-picking commit bdbb268.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/Uno.UI.Runtime.Skia.WebAssembly.Browser/UI/Xaml/Controls/TextBox/BrowserInvisibleTextBoxViewExtension.cs

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of c7e93ab has failed:

On branch mergify/bp/servicing/6.8/pr-24556
Your branch is ahead of 'origin/servicing/6.8' by 2 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit c7e93ab.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/Uno.UI.Runtime.Skia.WebAssembly.Browser/UI/Xaml/Controls/TextBox/BrowserInvisibleTextBoxViewExtension.cs

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify Bot added the conflicts Automated merge hit conflicts label Sep 21, 2026
@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 labels Sep 21, 2026
@ajpinedam
ajpinedam self-requested a review September 21, 2026 18:06
These tests were written before master gained a per-host placement policy
for the shared invisible <input />. Rebasing them on top of it left them
asserting tracking geometry unconditionally, which iOS hosts (input parked
off-screen, size and position ignored) and any session where accessibility
has detached the input would both fail.

Reuse the probe helpers master already has instead of a second copy, and
skip where there is deliberately nothing to measure — both policies are
pinned by When_Focused_In_Browser_Then_Hidden_Input_Placement_Matches_Host.

(cherry picked from commit de751c5)
@ajpinedam
ajpinedam force-pushed the mergify/bp/servicing/6.8/pr-24556 branch from 5d1ee92 to acf386e Compare September 23, 2026 01:15
@ajpinedam

Copy link
Copy Markdown
Contributor

Rebuilt this backport on top of the current servicing/6.8 (force-pushed 5d1ee92a0d → acf386e987).

Why it was conflicting: the original cherry-pick of bdbb268 failed, and Mergify pushed the conflict markers committed into BrowserInvisibleTextBoxViewExtension.cs (see the # Conflicts: trailer on the old commits). It failed for two reasons:

What changed: the six original commits were re-cherry-picked (-x) onto servicing/6.8. The net diff is identical to #24556 except for three lines, adapted to the 6.8 API:

-		if (_view.Core?.ContentElement is not { } contentElement)
+		if (_view.TextBox?.ContentElement is not { } contentElement)

(in both UpdateSize and UpdatePosition)

-		var x = _view.Core?.FlowDirection is FlowDirection.RightToLeft
+		var x = _view.TextBox?.FlowDirection is FlowDirection.RightToLeft

TextBox.ContentElement is the existing internal ContentControl on 6.8 (TextBox.skia.cs). PasswordBox still derives from TextBox on 6.8, so _view.TextBox covers it as _view.Core does on master. The test changes apply unmodified: the helpers they rely on came in with #24580.

Validation: Uno.UI.Runtime.Skia.WebAssembly.Browser and Uno.UI.RuntimeTests.Skia build cleanly locally (net10.0). The new tests are Skia-WASM only, so they're left to CI.

@ajpinedam
ajpinedam enabled auto-merge September 23, 2026 01:17
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

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

@unodevops

Copy link
Copy Markdown
Contributor

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

@ajpinedam
ajpinedam merged commit c86178e into servicing/6.8 Sep 23, 2026
43 of 44 checks passed
@ajpinedam
ajpinedam deleted the mergify/bp/servicing/6.8/pr-24556 branch September 23, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia conflicts Automated merge hit conflicts 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