Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add OpenChanged event to FluentProfileMenu #3486

Open
wxwyz opened this issue Mar 9, 2025 · 2 comments
Open

feat: Add OpenChanged event to FluentProfileMenu #3486

wxwyz opened this issue Mar 9, 2025 · 2 comments
Labels
triage New issue. Needs to be looked at

Comments

@wxwyz
Copy link

wxwyz commented Mar 9, 2025

🙋 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.

@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Mar 9, 2025
@dvoituron
Copy link
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.

@wxwyz
Copy link
Author

wxwyz commented Mar 9, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New issue. Needs to be looked at
Projects
None yet
Development

No branches or pull requests

2 participants