fix(character_limit) Return number of remaining or excess characters to screen reader

This commit is contained in:
Corinne Durrmeyer 2024-10-30 17:57:36 +01:00
parent d7c97f5775
commit f457c174ee
No known key found for this signature in database
GPG key ID: DDC049DDA35585B6
3 changed files with 9 additions and 8 deletions

View file

@ -1,3 +1,3 @@
en:
remaining_characters: You have %{remaining_words} characters remaining.
excess_characters: You have %{excess_words} characters too many.
excess_characters: You have exceeded the recommended size of %{excess_words} characters. Please reduce the number of characters.

View file

@ -1,3 +1,3 @@
fr:
remaining_characters: Il vous reste %{remaining_words} caractères.
excess_characters: Vous avez dépassé la taille conseillée de %{excess_words} caractères. Réduire le nombre de caractères.
excess_characters: Vous avez dépassé la taille conseillée de %{excess_words} caractères. Veuillez réduire le nombre de caractères.

View file

@ -1,9 +1,10 @@
~ @form.text_area(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, rows: 6, required: @champ.required?, value: html_to_string(@champ.value), data: { controller: 'autoresize' }))
- if @champ.character_limit_info?
%div{ role: 'status' }
- if @champ.character_limit_info?
%p.fr-info-text
= t('.remaining_characters', remaining_words: @champ.remaining_characters)
- if @champ.character_limit_warning?
%p.fr-icon--sm.fr-mt-4v.fr-mb-0.fr-hint-text.fr-icon-warning-fill.fr-text-default--warning.characters-count
- if @champ.character_limit_warning?
%p.fr-icon--sm.fr-mt-4v.fr-mb-0.fr-hint-text.fr-icon-warning-fill.fr-text-default--warning
= t('.excess_characters', excess_words: @champ.excess_characters)