Skip to content

feat: Add OpenChanged event to FluentProfileMenu #3486

Closed

Description

@wxwyz

🙋 Feature Request

Bubble up the open changed event so parent components can react to the popover state.

🤔 Expected Behavior

bind-Open reacts to changes within the FluentProfileMenu.

😯 Current Behavior

The Open property only flows downward into the FluentPopover.

💁 Possible Solution

A while back you made Open a public parameter, so we could control the visibility from the outside in #2737.

I believe the following may be all that is needed to fulfill bubbling back up the hierarchy.

FluentProfileMenu.razor

<FluentPopover AnchorId="@PersonaId"
               Class="@PopoverClass"
               Style="@PopoverStyle"
               HorizontalPosition="@HorizontalPosition.Start"
               @bind-Open:get="@Open"
               @bind-Open:set="@OpenChanged"
               @attributes="@AdditionalAttributes">
...
</FluentPopover>

FluentProfileMenu.razor.cs

@code {
    [Parameter]
    public EventCallback<bool> OpenChanged { get; set; }
}

🔦 Context

I make use of the hover style (--fluent-profile-menu-hover) on the outer FluentPersona, and would like to keep that engaged while the popover is visible. I also think it could be a nice to have feature for the menu itself, without us needing to hook into a change event to try to figure that out. However, the OpenChanged event would be a nice to have either way.

Activity

  1. added
    triage
    on Mar 9, 2025
  2. dvoituron commented on Mar 9, 2025

    @dvoituron
    Collaborator

    FluentMenuProvider is not intended to react to changes in the state of all menus in the application. The Provider exists only to render the HTML elements.

    You already have an OpenChanged in FluentMenu. And you can use it to detect when the menu will be closed.

  3. wxwyz commented on Mar 9, 2025

    @wxwyz
    Author

    Perhaps I'm not reading the code properly, but I'm not seeing the provider being used in this instance. FluentPopover seems to be using the AnchoredRegion directly, and the FluentPopover does bubble the OpenChanged event back up the hierarchy. However, the FluentProfileMenu doesn't continue that bubbleation (is that a word?). Am I missing a piece to the puzzle that uses the provider?

  4. added
    status:needs-investigation
    and removed
    triage
    on Mar 11, 2025
  5. added
    status:in-progress
    and removed
    status:needs-investigation
    on May 5, 2025
  6. dvoituron commented on May 5, 2025

    @dvoituron
    Collaborator

    Will be included in the next Release. See #3750

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

Metadata

Metadata

Labels

status:in-progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions