Skip to content

[WASM] Native Rendering: Wrong Textbox Behavior if started with Visibility="Collapsed" #22722

@Shore1149

Description

@Shore1149

Current behavior 🐛

Only in Native Rendering!

If a textbox is definied with Visibility="Collapsed", later switched to Visible, than the last char and the caret is hidden behind the X-Button.

Image

my guess, the size of the textbox is not updated correctly with the change of the visibility.

Expected behavior 🎯

like in Skia Rendering, the text should be always visible

Image

How to reproduce it (as minimally and precisely as possible) 🔬

Insert this in MainPage.xaml

<TextBox Visibility="Collapsed"
         x:Name="tbox" />
<Button Click="Button_Click"
        Content="Toggle" />

Insert this in CodeBehind in MainPage.xaml.cs

private void Button_Click(object sender, RoutedEventArgs e)
{
    if (tbox.Visibility == Visibility.Visible)
    {
        tbox.Visibility = Visibility.Collapsed;
    }
    else
    {
        tbox.Visibility = Visibility.Visible;
    }
}

Workaround 🛠️

Switch to SkiaRendering

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

WebAssembly

Uno.Sdk version (and other relevant versions) 📦

"Uno.Sdk": "6.5.31"
dotnet version: "9.0.310",

IDE version 🧑‍💻

Visual Studio 2022 17.14.25

Anything else we need to know? 💬

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriagedIndicates an issue requires triaging or verification

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions