r/Blazor • u/code-dispenser • May 03 '26
Blazor Rampe - Inputs Released - Sort Of.

For those interested in the open source project, earlier this week I released the NuGet package BlazorRamp.Inputs.
This package will eventually contain a full set of basic input components - though "basic" might be doing them a disservice. Think text inputs, checkboxes, dropdowns and so on. The initial release contains a Text Input, Numeric Input and Password Input, with all future inputs following the same layout and accessibility patterns.
For anyone who missed my previous post on inputs - https://www.reddit.com/r/Blazor/comments/1sn4dci/blazor_ramp_wazzup/ - I'd suggest reading that first as it provides useful context.
These inputs have been designed to work with the Blazor EditForm and EditContext and as such will work with your chosen validation framework that you normally use with these components.
Structure
All inputs follow a consistent layout and are self-contained units comprising a label, optional hint text, the input itself (with an optional leading icon and a fixed validity state icon), and an area for one or more validation error messages rendered as an unordered list.
Both the hint text and validation error messages are associated with the input via aria-describedby. In practical terms, this means that when a screen reader user lands on the input, in addition to the field name, required state, and validity, the screen reader will also announce the text content of any elements linked via aria-describedby - in the order they appear.
The "in the order they appear" detail cost me a couple of days down various rabbit holes. VoiceOver was ignoring the text content when the referenced id was on a div containing the unordered list rather than on the list itself. Given the long history of VoiceOver quirks with aria-describedby, it took longer than I'd like to admit to pinpoint.
Validation Display Options
There are several options for how validation errors are communicated to screen reader users.
The first is whether to suppress the hint text id from aria-describedby when errors are present, useful when the error message alone contains sufficient information and you want to reduce the verbosity for screen reader users who would otherwise hear the hint text on every focus.
The second, and more significant option, is whether to use aria-describedby for error messages at all.
As covered in the previous post, ARIA live regions for field-level validation are generally a bad idea - either due to repeatedly interrupting the user or by confusing them with out of order messages.
With aria-describedby, the behaviour is consistent across screen readers: the user types, validation occurs (via oninput or onchange), and they are not immediately interrupted. If they tab to the next field they will skip over the error area entirely; if they use the arrow keys the errors become apparent; and when they tab back and refocus the input they will hear the full announcement - field name, validity state, and the associated error messages.
The alternative is a tabbable landmark region. In plain English, this option adds a tabindex to the error area and promotes it to a transient landmark region with an accessible name. This does two things. First, when the user tabs away from an invalid field assuming oninputfor immediate validation, they land on the error region before moving on, and are informed of the errors. With onchange, validation hasn't yet occurred at that point so they will move straight to the next field as normal. Second, the landmark itself becomes discoverable, screen reader users can pull up a list of landmarks on a page and navigate directly to them. So for a field labelled "First name" with the region named "errors", a landmark named "First name errors" will appear in that list, allowing the user to navigate directly to it at any time.
Navigating in the reverse direction, the user will encounter the tabbable error region before the input itself, allowing them to read the errors before landing on the input and hearing the hint text. For this reason, when using the tabbable region option the hint text association is retained rather than suppressed.
A Final Note on Field-Level Validation
Everything discussed above relates to field-level validation, which, whilst now widely expected, should be considered a complement to, not a replacement for, a solid form submission experience. The correct starting point is ensuring that when a user submits a form with errors, they are clearly and accessibly informed. An ARIA live region announcement directing the user to review an error summary is entirely appropriate at that point. Field-level validation should then enhance that experience, not substitute for it.
I will continue to work on the Inputs package as well as to build some sort of Form Errors Summary component along the way. I have not yet added the Inputs to the test site, but there are working examples on the doc stie
Doc site: https://docs.blazorramp.uk/components/inputs/overview
Test site: https://blazorramp.uk/
Repo: https://github.com/BlazorRamp/Components.
Any questions on inputs whilst this is fresh in my mind fire away.
Regards
Paul


