fix: option list stays open after a mouse pick in single-select FluentAutocomplete

オープン
#5,715 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@dvoituron がすでに取り組んでいます。

2026年12月3日 から。

評価

この issue はまだ評価されていません。

説明

🐛 Bug Report

In v5, a FluentAutocomplete with Multiple="false" keeps its option list open after the user clicks an option. The pick is saved and shown, but the list stays open over the page until the user clicks somewhere else or presses Escape.

A pick made with the keyboard (ArrowDown + Enter) closes the list, so mouse and keyboard behave differently. In v4, the list closed after each pick (see #2819, which asked for a keepOpen option).

💻 Repro or Code Sample

<FluentAutocomplete TOption="string" TValue="string"
                    Label="Specialty"
                    Multiple="false"
                    ImmediateDelay="0"
                    OnOptionsSearch="Search"
                    @bind-SelectedItem="_picked" />

@code {
    private string? _picked;
    private static readonly string[] Items = ["Cardiology", "Dermatology", "Neurology", "Urology"];

    private void Search(OptionsSearchEventArgs<string> args) =>
        args.Items = Items.Where(item => item.Contains(args.Text ?? "", StringComparison.OrdinalIgnoreCase));
}
  1. Click the input and press ArrowDown, or type "o", to open the list.
  2. Click "Cardiology" with the mouse.

🤔 Expected Behavior

The list closes after the pick, as it does after Enter, and aria-expanded becomes false.

😯 Current Behavior

  • "Cardiology" shows as the picked value.
  • The list stays open: the fluent-popover-b keeps opened="true", and the other options stay visible and clickable.

💁 Possible Solution

InternalSelectedItemsChangedHandlerAsync (src/Core/Components/List/FluentAutocomplete.razor.cs) updates the pick and calls SetInputFocusAsync(), but it never sets _isOpen = false. The Enter path closes the list in two places: OnTextInputKeyDownAsync sets _isOpen = false, and the script calls Popover.closePopover().

A possible fix is to close the list in the single-select branch of that handler:

// Multiple = False
else
{
    ...
    _isOpen = false;
}

A multi-select list must stay open, so that the user can pick more items.

The code on dev at 9eb965ae is the same as in 5.1.0, so 5.2 still has this bug.

As a workaround, we call closePopover() on fluent-popover-b[anchor-id="<input id>"] after the pick renders. The popovertoggle event then sets Opened back to false, through OnToggleAsync and @bind-Opened.

🔦 Context

Single-select pickers (a long dropdown list, a person search, a group search) leave their list over the rest of the form after each mouse pick. Users read this as a broken dropdown.

🌍 Your Environment

  • OS & Device: Windows 11 on PC
  • Browser: Chromium (Playwright) and a Chromium-based desktop browser
  • .NET 10 and Fluent UI Blazor 5.1.0 (Blazor WebAssembly); also checked against dev at 9eb965ae
主要言語
C#
スター
4.9k
フォーク
500
平均マージ
15時間 28分
マージ済み PR(30日)
58

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/fluentui-blazor のほかの issue

microsoft/fluentui-blazor の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。