Module: LocoMotion::Concerns::AriableComponent

Overview

The AriableComponent concern wires up sensible default aria-* attributes for components (primarily form inputs) so that authors and users don't have to set them by hand.

It is intentionally conservative: native HTML controls already expose most of their semantics (checked, disabled, required, etc.) to assistive technology, so this concern only fills in attributes that are commonly expected and never overrides anything the user passed explicitly via the aria: shortcut or *_html options.

Current behavior

  • When the component's required option is truthy, adds aria-required="true" (unless the user already set aria-required).

Users can always set or override any aria-* attribute using the aria: shortcut, e.g. daisy_text_input(aria: { describedby: "email-help" }).