In Rails there are two ways of setting data
and aria
attributes when using the tag
and content_tag
helpers. These are to set the attribute by its full name data-controller: "abc", data-response: "xyz"
or to use a nested hash: data: { controller: "abc", response: "xyz" }
.This library, and both the components and form builder assume people are using the latter. Using the former might lead to unintended consequences.
It might make sense to detect the full name variant and either apply a conversion or provide some kind of warning to the developer. As this only applies to data-
and aria-
prefixed attributes the conversion should be straightforward.