Merge pull request #10665 from demarches-simplifiees/a11y-fix-suspect-email

Accessibilité : Assure la restitution par les TA du bloc de suggestion de l'adresse mail
This commit is contained in:
Paul Chavard 2024-07-30 09:53:01 +00:00 committed by GitHub
commit bced38eb78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 7 deletions

View file

@ -4,4 +4,5 @@ en:
aria_label: "Show password"
label: "Show"
email_suggest:
wanna_say: 'Do you mean to say ?'
mistake: "The address seems wrong"
wanna_say: "Do you mean to say:"

View file

@ -4,4 +4,5 @@ fr:
aria_label: "Afficher le mot de passe"
label: "Afficher"
email_suggest:
wanna_say: 'Voulez-vous dire ?'
mistake: "L'adresse semble erronée"
wanna_say: "Vouliez-vous écrire :"

View file

@ -29,10 +29,14 @@
%label.fr--password__checkbox.fr-label{ for: show_password_id }= t('.show_password.label')
- if email?
.suspect-email.hidden{ data: { "email-input-target": 'ariaRegion'}, aria: { live: 'off' } }
= render Dsfr::AlertComponent.new(title: t('.email_suggest.wanna_say'), state: :info, heading_level: :div) do |c|
.suspect-email.hidden{ data: { "email-input-target": 'ariaRegion' }, tabindex: '-1' }
= render Dsfr::AlertComponent.new(title: t('.email_suggest.mistake'), state: '', extra_class_names: 'fr-alert--info' ) do |c|
- c.with_body do
%p{ data: { "email-input-target": 'suggestion'} } exemple@gmail.com  ?
%p
= t('.email_suggest.wanna_say')
%span{ data: { "email-input-target": 'suggestion'} }
exemple@gmail.com
= "?"
%p
= button_tag type: 'button', class: 'fr-btn fr-btn--sm fr-mr-3w', data: { action: 'click->email-input#accept'} do
= t('utils.yes')

View file

@ -39,7 +39,7 @@ export class EmailInputController extends ApplicationController {
if (data && data.suggestions && data.suggestions.length > 0) {
this.suggestionTarget.innerHTML = data.suggestions[0];
show(this.ariaRegionTarget);
this.ariaRegionTarget.setAttribute('aria-live', 'assertive');
this.ariaRegionTarget.focus();
}
}

View file

@ -77,7 +77,7 @@ describe 'Creating a new dossier:', js: true do
find('label', text: 'Monsieur').click # force focus out
within "#identite-form" do
within '.suspect-email' do
expect(page).to have_content("Information : Voulez-vous dire ?")
expect(page).to have_content("L'adresse semble erronée Vouliez-vous écrire : prenom.nom@gmail.com ? Oui Non")
click_button("Oui")
end
click_button("Continuer")