@using System.Diagnostics.CodeAnalysis @using Microsoft.AspNetCore.Components.Forms @inherits InputBase @* A drop-in replacement for Blazor's built-in that updates the bound value on the `oninput` event instead of `onchange`. The built-in component only commits the value on blur, which means programmatically filled values (e.g. password-manager autofill) that never receive a blur are not bound, which can result in a a "required" validation error on submit. *@ @code { /// /// Commits the new value to the EditContext on every input event so autofilled values are captured immediately. /// private void OnInput(ChangeEventArgs e) { CurrentValueAsString = e.Value?.ToString(); } /// protected override bool TryParseValueFromString(string? value, out string? result, [NotNullWhen(false)] out string? validationErrorMessage) { result = value; validationErrorMessage = null; return true; } }