Inside an EditForm the file input is a form field like any other. Its Value is the names of
the valid files joined with commas (report.pdf,photo.png), or null while it holds none, so a
[Required] or a [RegularExpression] on the bound property validates the selection. A file the
component's own rules reject (here, anything but a PDF or a Word document) is not part of the value, and
while the value is invalid the browse button turns to the error color. Required also marks the
hidden input the value travels in, which Name makes readable by a plain form post. A browser cannot
be handed files from code, but emptying the bound value clears the selection.
ShowValidationMessage shows the messages of the form under the browse button, where
ErrorMessage goes, so the form below needs no ValidationMessage component. The button is
described by them through aria-describedby, so they are read out when it takes the focus, and an
ErrorMessage of the app's own wins the place while it is set. They are about the selection as a
whole: a file the component rejects on its own still says why in the list. They are not announced as they
appear: a submit validates every field at once, and a message from each of them read out in a row would
bury the form under its own errors. A BitParams holding a BitFileInputParams with
ShowValidationMessage turns it on for every file input inside it.
Not every rejection comes from an EditForm. Invalid forces the error look and the
aria-invalid of the browse button on a selection something else refused - a server, a rule spanning
two fields - and ErrorMessage adds the line that says why, right under the button and ahead of the
Description. It is about the selection as a whole: a file the component rejects itself still says
why in the list. A message implies Invalid, so the flag on its own is for marking a file input whose
explanation lives somewhere else. The button is described by the line, and a live region of its own, apart
from the one that announces the selection, says it the moment it appears. ErrorMessageTemplate puts
arbitrary markup there instead. A template has no text a screen reader can be handed, so it is announced as
a bare "Invalid input" unless ErrorMessageAriaLabel says what it shows.