Skip to content

fix: global overlay spinner flashes when opening a dialog #5282

Closed

Description

🐛 Bug Report

Opening a normal dialog can briefly display the spinner from the global FluentOverlay, even though the application never calls IDialogService.ShowOverlayAsync().

Setting LibraryConfiguration.UseGlobalOverlay to false removes the flash, confirming that the spinner comes from the global overlay registered by FluentDialogProvider.

💻 Repro or Code Sample

  1. Register Fluent UI components with the default configuration (where UseGlobalOverlay is true).
  2. Add <FluentProviders /> or <FluentDialogProvider /> to the application layout.
  3. Open any dialog through IDialogService, for example:
@inject IDialogService DialogService

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

@code {
    private async Task OpenDialogAsync()
    {
        await DialogService.ShowDialogAsync<DialogContent>(new DialogOptions
        {
            Title = "Test dialog",
        });
    }
}
  1. Observe that the global overlay spinner is briefly visible while the dialog opens.

The issue disappears with this configuration:

builder.Services.AddFluentUIComponents(options =>
    options.UseGlobalOverlay = false);

🤔 Expected Behavior

Opening a normal dialog should only display that dialog. The global overlay and its spinner should remain hidden unless the application explicitly calls ShowOverlayAsync().

😯 Current Behavior

The global overlay spinner flashes briefly when a normal dialog opens. The overlay is not intentionally opened and has no visible attribute.

💁 Possible Solution

The behavior appears to result from the interaction of two implementation details:

  1. FluentDialogProvider renders DialogService.Items.Values.OrderBy(i => i.Index) without an @key. The global overlay has Index = long.MaxValue, so it moves from the first rendered position to the last when a regular dialog is added. Blazor can therefore dispose and recreate the FluentOverlay component during the update.
  2. FluentOverlay.connectedCallback() defers initialize() with setTimeout(..., 0). Until initialization creates the closed shadow-DOM <dialog>, the global overlay's spinner remains visible as light-DOM content.

Preserving dialog identity with a key, or ensuring uninitialized overlay content cannot paint, should prevent the flash.

This is related to #4966, but that issue concerned the component registration/startup path and was closed as fixed by #4932. This report occurs while opening an ordinary dialog after the overlay component has registered.

🔦 Context

The spinner makes normal dialog opening look like an unexpected loading operation. Disabling the global overlay is an effective workaround, but it also prevents applications from using ShowOverlayAsync().

🌍 Your Environment

  • OS & Device: Windows PC
  • Browser: not yet isolated to a specific browser
  • Fluent UI Blazor version: current v5 implementation

Activity

  1. added
    triage
    on Sep 16, 2026
  2. JamesNK commented on Sep 16, 2026

    @JamesNK
    MemberAuthor

    Confirmed with Playwright against the unmodified local v5 demo at /Dialog using the first service-driven Open Dialog example.

    Instrumentation retained the initial #global-overlay element reference, observed child-list mutations in FluentDialogProvider, and sampled the spinner bounds on every animation frame around the click. One click produced this sequence:

    +62.7 ms  existing FLUENT-OVERLAY#global-overlay removed
    +63.0 ms  new FLUENT-OVERLAY#global-overlay added with FLUENT-DIALOG
    +64.9 ms  new overlay has no shadow root; spinner is rendered at 32 x 32
    +68.5 ms  spinner is still rendered at 32 x 32
    +73.5 ms  shadow root exists; native dialog is closed; spinner bounds are 0 x 0
    

    The old and new overlay DOM objects were different. The native <dialog> was never open, so this is not an erroneous Visible/ShowOverlayAsync() state transition. It is the light-DOM spinner painting while the recreated custom element waits for deferred initialization.

    This confirms both parts of the suspected cause: the provider update recreates the unkeyed global overlay, and connectedCallback() leaves its child content paintable until initialize() runs.

  3. MarvinKlein1508 commented on Sep 16, 2026

    @MarvinKlein1508
    Collaborator

    This could be related to #5187

  4. added
    status:needs-investigation
    and removed
    triage
    on Sep 16, 2026
  5. JamesNK commented on Sep 16, 2026

    @JamesNK
    MemberAuthor

    Fixed with #5283

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

Metadata

Metadata

Labels

status:needs-investigationv5

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions