fix: [v5] FluentValidationMessage icon shrinks when the validation message wraps

Open
#5,703 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@vnbaaij is already working on this.

Since Dec 2, 2026.

Assessment

This issue has not been assessed yet.

Description

🐛 Bug Report

When a validation message shown by FluentValidationMessage (inside FluentField) is long enough to wrap, the error icon shrinks. The longer the message, the smaller the icon. The icon should always stay 12px wide.

💻 Repro or Code Sample

<EditForm Model="@_model">
    <DataAnnotationsValidator />
    <FluentNumberField @bind-Value="_model.NumberOfInstalments"
                       Label="Number of Instalments"
                       Style="max-width: 150px" />
</EditForm>

@code {
    private readonly Model _model = new() { NumberOfInstalments = 43643436 };

    private sealed class Model
    {
        [Range(1, 12, ErrorMessage = "Exceeds the number of valid instalments for this period")]
        public int NumberOfInstalments { get; set; }
    }
}
  1. Render the field in a narrow container (e.g. max-width: 150px).
  2. Trigger validation so the long message wraps over several lines.
  3. Compare the error icon with a field that has a short, single-line message.

🤔 Expected Behavior

The error icon keeps the same size (12px) whatever the message length, and lines up with the first line of the message.

😯 Current Behavior

The icon is squeezed horizontally and gets smaller as the message gets longer. It is also vertically centred against the whole multi-line message instead of sitting next to the first line.

💁 Possible Solution

FluentValidationMessage.razor renders:

<div message>
    @CreateIcon(Icon)   @* FluentIcon, Width="12px" *@
    @message
</div>

and FluentValidationMessage.razor.css styles it as:

.fluent-validation-message > div[message] {
  display: flex;
  align-items: center;
}

The icon is a flex item with the default flex-shrink: 1, so it gives up width when the text wraps. Suggested fix:

.fluent-validation-message > div[message] {
  display: flex;
  align-items: flex-start; /* optional: line the icon up with the first line */
}

.fluent-validation-message > div[message] > svg {
  flex-shrink: 0;
}

🔦 Context

We use Fluent UI Blazor v5 inputs in forms where validation messages are often longer than the input is wide (e.g. number fields limited to ~150px). The shrinking icons look inconsistent across fields on the same page. We'd rather fix this upstream than add a local CSS override.

🌍 Your Environment

  • OS & Device: Windows 11, PC
  • Browser:
  • .NET and Fluent UI Blazor library version: .NET 11, Microsoft.FluentUI.AspNetCore.Components 5.1.0 (same CSS still on dev-v5)
Dominant language
C#
Stars
4.9k
Forks
500
Avg merge
15h 28m
Merged PRs (30d)
58

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.