A custom widget or theme takes its error state from hasWidgetErrors
Detect
- In your custom widget or theme: an error state computed from
rawErrors.length. - On the rendered page: your widget shows a red outline under
ui:hideError.
Change
rawErrors still holds every error while they are hidden. Derive the error state from the field's plan instead. hasWidgetErrors() reads the aria-invalid the plan gives the widget's control, with ui:hideError applied, and falls back to rawErrors with hideError only for a widget rendered without a plan:
-const hasError = rawErrors.length > 0;
+const hasError = hasWidgetErrors(props);
A widget that draws its own messages reads them from getErrorsToDraw(). The deprecated members are in displayLabel, rawErrors, hideLabel and getDisplayLabel are deprecated.
Because hasWidgetErrors() follows the plan's aria-invalid, an anyOf/oneOf option's control is styled invalid while the field above it draws the errors.
Verify
- Your widget is styled invalid when its field shows errors, and plain under
ui:hideError.
Also read: