Use aria-describedby to link notice and input again
https://www.w3.org/WAI/tutorials/forms/instructions/#using-aria-describedby
This commit is contained in:
parent
84b125d272
commit
bc85e9b7ec
3 changed files with 9 additions and 2 deletions
|
@ -25,4 +25,10 @@ module ChampHelper
|
||||||
end
|
end
|
||||||
simple_format(auto_linked_text, {}, sanitize: false)
|
simple_format(auto_linked_text, {}, sanitize: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def describedby_id(champ)
|
||||||
|
if champ.description.present?
|
||||||
|
"desc-#{champ.type_de_champ.id}-#{champ.row}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,4 +8,4 @@
|
||||||
= "modifié le #{try_format_datetime(champ.updated_at)}"
|
= "modifié le #{try_format_datetime(champ.updated_at)}"
|
||||||
|
|
||||||
- if champ.description.present?
|
- if champ.description.present?
|
||||||
.notice= string_to_html(champ.description)
|
.notice{ id: describedby_id(champ) }= string_to_html(champ.description)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
= form.text_field :value,
|
= form.text_field :value,
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
required: champ.mandatory?
|
required: champ.mandatory?,
|
||||||
|
aria: { describedby: describedby_id(champ) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue