Add aria accessibility regarding the hidden class on partial choose email

This commit is contained in:
Kara Diaby 2024-08-28 09:12:46 +00:00
parent 0b4a9bb3bb
commit 07ea31fc4c
No known key found for this signature in database
GPG key ID: C4D1B0CF9F24D759
2 changed files with 5 additions and 3 deletions

View file

@ -20,10 +20,12 @@ export class EmailFranceConnectController extends ApplicationController {
) as HTMLInputElement; ) as HTMLInputElement;
if (checkedTarget && checkedTarget.value === 'false') { if (checkedTarget && checkedTarget.value === 'false') {
this.emailFieldTarget.classList.remove('fr-hidden'); this.emailFieldTarget.classList.remove('hidden');
this.emailFieldTarget.setAttribute('aria-hidden', 'false');
inputElement.setAttribute('required', ''); inputElement.setAttribute('required', '');
} else { } else {
this.emailFieldTarget.classList.add('fr-hidden'); this.emailFieldTarget.classList.add('hidden');
this.emailFieldTarget.setAttribute('aria-hidden', 'true');
inputElement.removeAttribute('required'); inputElement.removeAttribute('required');
inputElement.value = ''; inputElement.value = '';
} }

View file

@ -22,7 +22,7 @@
%label.fr-label.fr-text--wrap{ for: 'use_france_connect_email_no' } %label.fr-label.fr-text--wrap{ for: 'use_france_connect_email_no' }
= t('.use_another_email') = t('.use_another_email')
.fr-fieldset__element.fr-fieldset__element--inline.fr-hidden{ data: { email_france_connect_target: "emailField", controller: 'email-input', email_input_url_value: show_email_suggestions_path } } .fr-fieldset__element.fr-fieldset__element--inline.hidden{ aria: { hidden: true }, data: { email_france_connect_target: "emailField", controller: 'email-input', email_input_url_value: show_email_suggestions_path } }
= f.label :email, t('.alternative_email'), class: "fr-label" = f.label :email, t('.alternative_email'), class: "fr-label"
%span.fr-hint-text.mb-1= t('activerecord.attributes.user.hints.email') %span.fr-hint-text.mb-1= t('activerecord.attributes.user.hints.email')
= f.email_field :email, class: "fr-input" = f.email_field :email, class: "fr-input"