Module: LocoMotion::Concerns::AriableComponent
- Extended by:
- ActiveSupport::Concern
- Included in:
- Daisy::DataInput::CheckboxComponent, Daisy::DataInput::FileInputComponent, Daisy::DataInput::OtpComponent, Daisy::DataInput::RadioButtonComponent, Daisy::DataInput::RangeComponent, Daisy::DataInput::SelectComponent, Daisy::DataInput::TextAreaComponent, Daisy::DataInput::TextInputComponent
- Defined in:
- lib/loco_motion/concerns/ariable_component.rb
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
requiredoption is truthy, addsaria-required="true"(unless the user already setaria-required).
Users can always set or override any aria-* attribute using the aria:
shortcut, e.g. daisy_text_input(aria: { describedby: "email-help" }).