Skip to content

Commit

Permalink
Fix 3379 by setting position in inline style when multiple (#3380)
Browse files Browse the repository at this point in the history
Co-authored-by: Denis Voituron <[email protected]>
  • Loading branch information
vnbaaij and dvoituron authored Feb 18, 2025
1 parent ae538e7 commit ce43fde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>All people whose first name starts with a "J" are initialy selected through the <code>OptionSelected</code> (Func delegate) parameter.</p>
<p>All people with a birth year greater than 1990 are disabled through the <code>OptionDisabled</code> (Func delegate) parameter.</p>

<div style="display: block; height: 300px;">

<FluentSelect TOption="Person"
Label="Select persons"
Items="@Data.People"
Expand All @@ -15,7 +15,7 @@
OptionSelected="@(p => p.FirstName.StartsWith("J"))"
@bind-Value="@SelectedValue"
@bind-SelectedOptions="@SelectedOptions" />
</div>


<p>
Selected value: @SelectedValue <br />
Expand All @@ -35,4 +35,4 @@
{
IEnumerable<Person>? SelectedOptions;
string? SelectedValue;
}
}
5 changes: 5 additions & 0 deletions src/Core/Components/List/FluentSelect.razor.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ------------------------------------------------------------------------
// MIT License - Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------------------

using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

Expand All @@ -13,6 +17,7 @@ public partial class FluentSelect<TOption> : ListComponentBase<TOption> where TO

/// <summary />
protected virtual MarkupString InlineStyleValue => new InlineStyleBuilder()
.AddStyle($"#{Id}::part(listbox)", "position", "relative", Multiple)
.AddStyle($"#{Id}::part(listbox)", "max-height", Height, !string.IsNullOrWhiteSpace(Height))
.AddStyle($"#{Id}::part(listbox)", "height", "fit-content", !string.IsNullOrWhiteSpace(Height))
.AddStyle($"#{Id}::part(listbox)", "z-index", ZIndex.SelectPopup.ToString())
Expand Down

0 comments on commit ce43fde

Please sign in to comment.