From 6f7e7f43d62665911a7250a7c7e833b36c8a7e48 Mon Sep 17 00:00:00 2001 From: Corinne Durrmeyer Date: Fri, 20 Sep 2024 14:31:54 +0200 Subject: [PATCH 1/3] Password complexity : Adds component vocalization for ATs --- .../activate_account_form_component.html.haml | 2 +- .../password_complexity_component.html.haml | 7 ++++--- app/views/administrateurs/activate/new.html.haml | 2 +- app/views/devise/passwords/edit.html.haml | 9 ++++----- app/views/experts/avis/sign_up.html.haml | 2 +- app/views/gestionnaires/activate/new.html.haml | 2 +- app/views/users/registrations/new.html.haml | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/components/instructeurs/activate_account_form_component/activate_account_form_component.html.haml b/app/components/instructeurs/activate_account_form_component/activate_account_form_component.html.haml index f3a324b20..c92729a6f 100644 --- a/app/components/instructeurs/activate_account_form_component/activate_account_form_component.html.haml +++ b/app/components/instructeurs/activate_account_form_component/activate_account_form_component.html.haml @@ -16,7 +16,7 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, - opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}}) #password_complexity = render PasswordComplexityComponent.new diff --git a/app/components/password_complexity_component/password_complexity_component.html.haml b/app/components/password_complexity_component/password_complexity_component.html.haml index e4813b617..21d95aeb2 100644 --- a/app/components/password_complexity_component/password_complexity_component.html.haml +++ b/app/components/password_complexity_component/password_complexity_component.html.haml @@ -1,6 +1,7 @@ -%div{ class: complexity_classes } +%div{ "aria-hidden":"true", class: complexity_classes } -%div{ class: alert_classes } - %h3.fr-alert__title= title +#password_hint{ class: alert_classes } + %h3.fr-alert__title{ "aria-live": "polite", "aria-atomic": "true" } + = title - if !success? = t(".hint_html") diff --git a/app/views/administrateurs/activate/new.html.haml b/app/views/administrateurs/activate/new.html.haml index c54d3dec2..0dca181ed 100644 --- a/app/views/administrateurs/activate/new.html.haml +++ b/app/views/administrateurs/activate/new.html.haml @@ -18,7 +18,7 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, - opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}}) #password_complexity = render PasswordComplexityComponent.new diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index f35c61eb3..692730a63 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -18,11 +18,10 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, - opts: { autofocus: 'true', autocomplete: 'new-password', minlength: PASSWORD_MIN_LENGTH, data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) do |c| - - c.with_describedby do - %div{ id: c.describedby_id } - #password_complexity - = render PasswordComplexityComponent.new + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}}) + + #password_complexity + = render PasswordComplexityComponent.new .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password_confirmation, input_type: :password_field, opts: { autocomplete: 'new-password' }) diff --git a/app/views/experts/avis/sign_up.html.haml b/app/views/experts/avis/sign_up.html.haml index e82fcc956..72d5da9ea 100644 --- a/app/views/experts/avis/sign_up.html.haml +++ b/app/views/experts/avis/sign_up.html.haml @@ -14,7 +14,7 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, - opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}}) #password_complexity = render PasswordComplexityComponent.new diff --git a/app/views/gestionnaires/activate/new.html.haml b/app/views/gestionnaires/activate/new.html.haml index 07ff36f96..5f91c40ea 100644 --- a/app/views/gestionnaires/activate/new.html.haml +++ b/app/views/gestionnaires/activate/new.html.haml @@ -18,7 +18,7 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, - opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}}) #password_complexity = render PasswordComplexityComponent.new diff --git a/app/views/users/registrations/new.html.haml b/app/views/users/registrations/new.html.haml index 5c5f85de2..cbefa0140 100644 --- a/app/views/users/registrations/new.html.haml +++ b/app/views/users/registrations/new.html.haml @@ -19,7 +19,7 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, - opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}}) #password_complexity = render PasswordComplexityComponent.new From 6e960d2b21a448e918e5d3419712b6cc37441090 Mon Sep 17 00:00:00 2001 From: Corinne Durrmeyer Date: Fri, 20 Sep 2024 15:07:16 +0200 Subject: [PATCH 2/3] Remove useless attributes --- app/views/devise/passwords/edit.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 692730a63..95cb39a74 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -12,8 +12,8 @@ = f.hidden_field :reset_password_token - %fieldset.fr-mb-0.fr-fieldset{ aria: { labelledby: 'edit-password-legend' } } - %legend.fr-fieldset__legend#edit-password-legend + %fieldset.fr-mb-0.fr-fieldset + %legend.fr-fieldset__legend %h1.fr-h2= I18n.t('views.users.passwords.edit.subtitle') .fr-fieldset__element From d79fb436354b6c10d81578aeb845f5d92df4a547 Mon Sep 17 00:00:00 2001 From: Corinne Durrmeyer Date: Fri, 20 Sep 2024 15:07:43 +0200 Subject: [PATCH 3/3] Add forgotten hint --- app/views/devise/passwords/edit.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 95cb39a74..4227eaea8 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -16,6 +16,9 @@ %legend.fr-fieldset__legend %h1.fr-h2= I18n.t('views.users.passwords.edit.subtitle') + .fr-fieldset__element + %p.fr-text--sm= t('utils.asterisk_html') + .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}})