diff --git a/app/components/dossiers/individual_form_component/individual_form_component.html.haml b/app/components/dossiers/individual_form_component/individual_form_component.html.haml index 38a5b2b19..cbff6389d 100644 --- a/app/components/dossiers/individual_form_component/individual_form_component.html.haml +++ b/app/components/dossiers/individual_form_component/individual_form_component.html.haml @@ -74,4 +74,4 @@ .fr-fieldset__element.fr-fieldset__element--short-text{ "data-for-tiers-target" => "emailContainer", class: class_names(hidden: !email_notifications?(individual)) } = render Dsfr::InputComponent.new(form: individual, attribute: :email, input_type: :email_field, opts: { "data-for-tiers-target" => "emailInput" }) - = f.submit t('views.users.dossiers.identite.continue'), class: "fr-btn" + = f.submit t('views.users.dossiers.identite.continue'), class: "fr-btn", "data-email-input-target": "next" diff --git a/app/javascript/controllers/email_input_controller.ts b/app/javascript/controllers/email_input_controller.ts index d35458e1e..63fce7953 100644 --- a/app/javascript/controllers/email_input_controller.ts +++ b/app/javascript/controllers/email_input_controller.ts @@ -44,15 +44,25 @@ export class EmailInputController extends ApplicationController { } accept() { - this.ariaRegionTarget.setAttribute('aria-live', 'off'); hide(this.ariaRegionTarget); this.inputTarget.value = this.suggestionTarget.innerHTML; this.suggestionTarget.innerHTML = ''; + const nextTarget = document.querySelector( + '[data-email-input-target="next"]' + ); + if (nextTarget) { + nextTarget.focus(); + } } discard() { - this.ariaRegionTarget.setAttribute('aria-live', 'off'); hide(this.ariaRegionTarget); this.suggestionTarget.innerHTML = ''; + const nextTarget = document.querySelector( + '[data-email-input-target="next"]' + ); + if (nextTarget) { + nextTarget.focus(); + } } } diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 78737be64..795162cec 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -19,4 +19,4 @@ .fr-fieldset__element = render Dsfr::InputComponent.new(form: f, attribute: :email, input_type: :email_field, opts: { autocomplete: 'email', autofocus: true }) - = f.submit t('devise.passwords.new.request_new_password'), class: 'fr-btn fr-btn--lg fr-mt-4w' + = f.submit t('devise.passwords.new.request_new_password'), class: 'fr-btn fr-btn--lg fr-mt-4w', 'data-email-input-target': 'next' diff --git a/app/views/users/registrations/new.html.haml b/app/views/users/registrations/new.html.haml index 7db21e4d7..7cd63b6a2 100644 --- a/app/views/users/registrations/new.html.haml +++ b/app/views/users/registrations/new.html.haml @@ -20,7 +20,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 }, aria: {describedby: 'password_hint'}}) + opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path, email_input_target: 'next'}, aria: {describedby: 'password_hint'}}) #password_complexity = render PasswordComplexityComponent.new diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml index 2a9ee38b0..880d346d6 100644 --- a/app/views/users/sessions/new.html.haml +++ b/app/views/users/sessions/new.html.haml @@ -18,7 +18,7 @@ .fr-fieldset__element= render Dsfr::InputComponent.new(form: f, attribute: :email, input_type: :email_field, opts: { autocomplete: 'email', autofocus: true }) .fr-fieldset__element - = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, opts: { autocomplete: 'current-password' }) + = render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, opts: { autocomplete: 'current-password', 'data-email-input-target': 'next' }) %p= link_to t('views.users.sessions.new.reset_password'), new_user_password_path, class: "fr-link"