Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix: Cannot reopen dialog after closing with escape key in FluentDialog

Closed Beginner friendly
#5,572 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@bryan-ramirez is already working on this.

Since Oct 28, 2026.

  • #5573 by @bryan-ramirez — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
frontend

Research direction

Start in FluentDialog.OnToggleAsync and inspect the conditional comparing args.Id with Instance?.Id; the issue provides the proposed comparison with Id. Reproduce with the markup-based FluentDialog sample, close it with Escape, and verify that the OnStateChange event fires and the dialog can be reopened with ShowAsync.

Written by the indexing model from the issue text.

Description

🐛 Bug Report

When a FluentDialog is instantiated from markup instead of DialogService, FluentDialog.OnToggleAsync ignores the toggle event. This happens because id doesn't match Instance?.Id because Instance is only set for dialogs launched through DialogService.

💻 Repro or Code Sample

@page "/dialog-repro"

<FluentButton OnClick="OpenAsync">Open dialog</FluentButton>

<p>OnStateChange events: @(_events.Count == 0 ? "(none)" : string.Join(", ", _events))</p>

<FluentDialog @ref="_dialog" OnStateChange="OnStateChange">
    <FluentDialogBody>
        <TitleTemplate>Repro</TitleTemplate>
        <ChildContent>Press Escape to close this dialog.</ChildContent>
    </FluentDialogBody>
</FluentDialog>

@code {
    private FluentDialog? _dialog;
    private readonly List<string> _events = new();

    private Task OpenAsync() => _dialog!.ShowAsync();

    private void OnStateChange(DialogEventArgs e) => _events.Add(e.State.ToString());
}

🤔 Expected Behavior

When I open a dialog, then close it using the escape key, I should be able to reopen it.

😯 Current Behavior

Instead, the dialog cannot be reopened.

💁 Possible Solution

Change the conditional
if (string.CompareOrdinal(args.Id, Instance?.Id) != 0)

to
``if (string.CompareOrdinal(args.Id, Id) != 0)`

I will create a PR that does this.

🔦 Context

It has caused a bug in my web application, but I was able to fix it with an ugly workaround.

🌍 Your Environment

  • Mac OS on Macbook Pro (m1)
  • Firefox, and Chrome (did not check others)
  • .NET 10 and Fluent UI Blazor library Version 5.0.1
Dominant language
C#
Stars
4.9k
Forks
493
Avg merge
1d 1h
Merged PRs (30d)
77

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/fluentui-blazor

All issues in microsoft/fluentui-blazor

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.