E_VALIDATION_FAILURE responses lack ARIA live region attributes in AdonisJS Validator
0 reputation · 14 Jun 2023, 08:28 UTC
0 reputation · 14 Jun 2023, 08:28 UTC
The AdonisJS Validator returns an E_VALIDATION_FAILURE error with a plain JSON payload containing message strings. These responses do not include role="alert" or aria-live="polite" attributes, so screen readers do not announce the errors unless developers manually wrap them in ARIA‑live containers or supply custom formatters.
An open repository discussion proposes a global accessibility hook that would automatically inject the necessary ARIA attributes into every validation error response. However, no consensus exists on whether the feature should be opt‑in middleware, enabled by default, or deferred to a future major release that could introduce breaking changes to the Validator API in version 5.x.
What are the performance implications of automatically injecting role="alert" and aria-live="polite" into validation error responses? Should the accessibility enhancement be opt‑in via middleware or applied globally by default? How would a future major release handle backward compatibility for custom formatters that already manage ARIA attributes?
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.