Numeric inputs carry a title shown as a tooltip and used as a fallback name
Detect
- In your DOM snapshots: a new
titleattribute on numeric inputs. - On the rendered page: hovering a
number/integerfield shows "Enter a number" or "Enter a whole number". - In a screen reader or accessibility test: a numeric field with no label (
ui:options: { label: false }, or a layout that hides it) is announced by that text where it was unnamed. - In your code: a
BaseInputTemplateof your own that renders a plain<input>without thattitle.
Change
The browser reports a failed pattern as a bare "Please match the requested format", so RJSF sets a title on the numeric input for the browser to append to that message. It is set whenever the pattern is, so the browser also shows it as a tooltip. Because title is the last fallback in accessible-name computation, an unlabelled numeric field is announced by it, with the same name for every such field on the page.
The strings go through translateString as TranslatableString.NumberInputTitle and TranslatableString.IntegerInputTitle; the new TranslatableString keys lists them with the others to handle.
Give an unlabelled field a ui:title or an aria-label if the tooltip or the shared name matters, or your own pattern or title. Your own pattern replaces the derived one and takes the derived title with it, since that title describes a rule no longer in force. Pass it as the pattern prop of BaseInputTemplate from a widget in any theme, through extraProps in shadcn and react-bootstrap, or through slotProps.htmlInput in mui. Your own title reaches the input as a widget prop in core and daisyui, through extraProps in shadcn and react-bootstrap, or through slotProps.htmlInput in mui. The other themes render a fixed set of props, so it doesn't reach the input there.
A BaseInputTemplate of your own that renders a plain <input> takes the title from getBaseInputProps(), which returns it beside the input props. Put it before them:
-const inputProps = getInputProps(schema, type, options);
-<input id={id} {...inputProps} />
+const { title, ...inputProps } = getBaseInputProps(props);
+<input id={id} title={title} {...inputProps} />
Verify
- A numeric field shows the translated title as its tooltip, and the browser appends it to its pattern message.
- An unlabelled field is announced by the
ui:titleoraria-labelyou set. - Updated snapshots show the new
titleattribute.
Also read: