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

Abierto
#5,703 1 comentario 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@vnbaaij ya está trabajando en esto.

Desde el 2/12/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

🐛 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)
Lenguaje dominante
C#
Estrellas
4.9k
Forks
500
Merge medio
15 h 28 min
PR fusionados (30 d)
58

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/fluentui-blazor

Todos los issues de microsoft/fluentui-blazor

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.