Skip to content

[BUG] VisualState not updating properly when closing a popup from Popup V2 #2903

@gchapeaux

Description

@gchapeaux

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

To simplify, picture a simple popup (with the popup V2 implementation) with a single button in it, used to close the popup.
When running my app on Windows and opening the popup, the popup seem to work just fine. However, when closing the popup, and re-opening it, the button appears to be stuck in the "Pressed" VisualState. Clicking on it then calls the command as expected, but the button doesn't have the correct appearance.

A Gif video showing the issue :

Image

Expected Behavior

When reopening the popup, the button should be using the "Normal" VisualState instead of "Pressed".

Steps To Reproduce

  1. Open and run the solution from the reproduction repository
  2. Open the popup, and close it by clicking on the "Close" button
  3. Open the popup again : the button uses the wrong VisualState.
    (4. There is actually a trick to "reset" the button : click and hold on the button, then get the mouse pointer out of the clickable zone. Somehow it resets it.)

Link to public reproduction project repository

https://github.com/gchapeaux/Sandbox_Popup

Environment

- .NET MAUI CommunityToolkit: 12.2.0
- OS: Windows 11 Professionnal
- .NET MAUI: Maui 9.0

Anything else?

I tried an unsuccessful workaround, but still worth sharing : I wanted to manually update the button's VisualState through its OnClicked event. However, with this tentative, the button appears at first in the correct VisualState, but once mouseovered it goes back to the "Pressed" state.

EDIT : a workaround suggested by @bijington : declare the popup as Transient instead of Singleton

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions