Skip to content

VisualState setter equal to the inherited value is not stored, so later inherited changes win #24600

Closed

Description

@MartinZikmund

Current behavior 🐛

A VisualState Setter (or animation value) whose value is the same object as the property's current effective value (for example an inherited brush) is not stored at animation precedence. BindingPath.Value skips the write when the new value equals the effective value. A later lower-precedence change, such as an inherited Foreground or a RequestedTheme switch, then wins over what the setter should hold.

Concrete case: an editable ComboBox in a Dark-themed app goes Focused → Normal → Focused. On re-entering Focused, the Focused Foreground setter's brush is the same instance as the inherited Dark brush, so it isn't stored. The next setter in the state, RequestedTheme=Light, then freezes the Light default brush, and the text renders dark on dark (#E4000000).

On WebAssembly with accessibility enabled, focusing the TextBox bounces focus (Focused → Normal → Focused within one call), so this happens on every focus. That makes Given_ElementTheme.When_Editable_ComboBox_Focused_In_Dark_Theme_Text_Is_Light and …Without_Theme_Walk_Text_Is_Light fail whenever an earlier test in the shard has enabled accessibility (12 of the last 30 master builds; they pass on the retry).

Expected behavior 🎯

As in WinUI (VisualStateSetterHelper → SetAnimatedValue, which always stores the value and clears the "local value is newer" flag), setter and animation values always take their precedence slot, even when they equal the current effective value.

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

A VisualState with a Setter Foreground= pointing to the same brush instance the element currently inherits. Enter the state, then change the inherited brush (e.g. the parent's Foreground). The element follows the parent instead of keeping the setter's value.

Workaround 🛠️

None.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

WebAssembly, Android, iOS, Windows (Skia Desktop), macOS, Linux

Uno.Sdk version (and other relevant versions) 📦

master (7.0)

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

No response

Activity

  1. added
    kind/bug
    on Sep 23, 2026
  2. Jen-Uno commented on Sep 30, 2026

    @Jen-Uno
    Contributor

    QA: closing out without a manual pass. The fix in #24601 ships with automated tests (Given_ElementTheme.cs, Given_VisualStateManager.cs, Given_Storyboard.cs) that exercise the change.

    If you still see this behaviour on a build that includes that PR, please reopen or comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions