Skip to content

[dev-v5] fix: focus is lost when a toast is disappearing #4740

@MarvinKlein1508

Description

@MarvinKlein1508

🐛 Bug Report

Disappearing toast notifications automatically removes the current focus from any component on the website.

💻 Repro or Code Sample

@page "/Debug/Test"
@layout FluentUI.Demo.Client.Layout.EmptyLayout
@inject IToastService toastService
@inject IDialogService dialogService
<h3>Test</h3>

<FluentButton OnClick="ShowToastAsync">Show Toast</FluentButton>

<FluentStack>
    <FluentTextInput @bind-Value="@test" Label="Test" Width="100%" />
</FluentStack>


<FluentToastProvider />
@code {
    public string test { get; set; } = "";

    private Task ShowToastAsync()
    {
        return toastService.ShowToastInstanceAsync(new ToastOptions
            {
                Timeout = 2000,
                Title = "Test toast",
                Intent = ToastIntent.Success,
                IsDismissable = true,
                Position = ToastPosition.TopEnd
            });
    }
}
  1. Press Show Toast
  2. Quickly press into the input and start typing for 3 seconds
  3. notice how the input loses it's focus after 2 seconds (timeout from toast)

🤔 Expected Behavior

I expect the input to not lose focus

😯 Current Behavior

The input loses it's focus and the user needs to click on it again

2026-04-22.14-06-47.mp4

💁 Possible Solution

🔦 Context

🌍 Your Environment

  • OS & Device: Windows 11 64 Bit
  • Browser latest Firefox, Chrome and Edge
  • latest dev-v5 branch

Metadata

Metadata

Assignees

Labels

bugA bugv5For the next major version

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions