Merge pull request #10313 from mfo/US/stop-using-placeholder-and-title-attribute

ETQ usage, je souhaite que les aides à la saisie soient vocalisées par le screenreader
This commit is contained in:
mfo 2024-04-17 14:57:14 +00:00 committed by GitHub
commit 009738f26b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 19 additions and 19 deletions

View file

@ -1,4 +1,4 @@
= @form.text_field(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, inputmode: :numeric, min: 1, pattern: "[0-9]{1,12}", placeholder: "Numéro de dossier", autocomplete: 'off', required: @champ.required?, class: "width-33-desktop #{@champ.blank? ? '' : 'small-margin'}")) = @form.text_field(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, inputmode: :numeric, min: 1, pattern: "[0-9]{1,12}", autocomplete: 'off', required: @champ.required?, class: "width-33-desktop #{@champ.blank? ? '' : 'small-margin'}"))
- if !@champ.blank? - if !@champ.blank?
- if dossier.blank? - if dossier.blank?

View file

@ -1 +1 @@
= @form.text_field(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, placeholder: @champ.libelle, required: @champ.required?, pattern: "-?[0-9]*", inputmode: :decimal)) = @form.text_field(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, required: @champ.required?, pattern: "-?[0-9]*", inputmode: :decimal))

View file

@ -1,3 +0,0 @@
---
en:
title: "The RNA number must begin with a capital W followed by 9 digits"

View file

@ -1,3 +0,0 @@
---
fr:
title: "Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres et lettres"

View file

@ -1,4 +1,4 @@
= @form.text_field(:value, input_opts( id: @champ.input_id, aria: { describedby: @champ.describedby_id }, data: { controller: 'turbo-input', turbo_input_load_on_connect_value: @champ.prefilled? && @champ.value.present? && @champ.data.blank?, turbo_input_url_value: champs_rna_path(@champ.id) }, required: @champ.required?, pattern: "W[0-9]{9}", title: t(".title"), class: "width-33-desktop", maxlength: 10)) = @form.text_field(:value, input_opts( id: @champ.input_id, aria: { describedby: @champ.describedby_id }, data: { controller: 'turbo-input', turbo_input_load_on_connect_value: @champ.prefilled? && @champ.value.present? && @champ.data.blank?, turbo_input_url_value: champs_rna_path(@champ.id) }, required: @champ.required?, pattern: "W[0-9]{9}", class: "width-33-desktop", maxlength: 10))
.rna-info{ id: dom_id(@champ, :rna_info) } .rna-info{ id: dom_id(@champ, :rna_info) }
= render 'shared/champs/rna/association', champ: @champ, error: nil = render 'shared/champs/rna/association', champ: @champ, error: nil

View file

@ -1,3 +0,0 @@
---
en:
title: "The SIRET number must have exactly 14 digits"

View file

@ -1,3 +0,0 @@
---
fr:
title: "Le numéro de SIRET doit comporter exactement 14 chiffres"

View file

@ -1,4 +1,4 @@
= @form.text_field(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, data: { controller: 'turbo-input', turbo_input_load_on_connect_value: @champ.prefilled? && @champ.value.present? && @champ.etablissement.blank?, turbo_input_url_value: champs_siret_path(@champ.id) }, required: @champ.required?, pattern: "[0-9]{14}", title: t(".title"), class: "width-33-desktop", maxlength: 14)) = @form.text_field(:value, input_opts(id: @champ.input_id, aria: { describedby: @champ.describedby_id }, data: { controller: 'turbo-input', turbo_input_load_on_connect_value: @champ.prefilled? && @champ.value.present? && @champ.etablissement.blank?, turbo_input_url_value: champs_siret_path(@champ.id) }, required: @champ.required?, pattern: "[0-9]{14}", class: "width-33-desktop", maxlength: 14))
.siret-info{ id: dom_id(@champ, :siret_info) } .siret-info{ id: dom_id(@champ, :siret_info) }
- if @champ.etablissement.present? - if @champ.etablissement.present?
= render EditableChamp::EtablissementTitreComponent.new(etablissement: @champ.etablissement) = render EditableChamp::EtablissementTitreComponent.new(etablissement: @champ.etablissement)

View file

@ -0,0 +1,6 @@
en:
activerecord:
attributes:
champs/dossier_link_champ:
hints:
value: "File number"

View file

@ -0,0 +1,6 @@
fr:
activerecord:
attributes:
champs/dossier_link_champ:
hints:
value: "Numéro de dossier"

View file

@ -16,7 +16,7 @@ describe 'The user' do
fill_in('date', with: '12-12-2012', match: :first) fill_in('date', with: '12-12-2012', match: :first)
fill_in('datetime', with: Time.zone.parse('2023-01-06T07:05')) fill_in('datetime', with: Time.zone.parse('2023-01-06T07:05'))
find("input[type=datetime-local]").send_keys(:arrow_up).send_keys(:arrow_down) # triggers onChange find("input[type=datetime-local]").send_keys(:arrow_up).send_keys(:arrow_down) # triggers onChange
fill_in('number', with: '42') # fill_in('number', with: '42'), deadchamp, should be migrated to textchamp
fill_in('decimal_number', with: '17') fill_in('decimal_number', with: '17')
fill_in('integer_number', with: '12') fill_in('integer_number', with: '12')
scroll_to(find_field('checkbox'), align: :center) scroll_to(find_field('checkbox'), align: :center)
@ -59,7 +59,7 @@ describe 'The user' do
expect(champ_value_for('textarea')).to eq('super textarea') expect(champ_value_for('textarea')).to eq('super textarea')
expect(champ_value_for('date')).to eq('2012-12-12') expect(champ_value_for('date')).to eq('2012-12-12')
expect(champ_value_for('datetime')).to eq(Time.zone.parse('2023-01-06T07:05:00').iso8601) expect(champ_value_for('datetime')).to eq(Time.zone.parse('2023-01-06T07:05:00').iso8601)
expect(champ_value_for('number')).to eq('42') # expect(champ_value_for('number')).to eq('42'), deadchamp, should be migrated to textchamp
expect(champ_value_for('decimal_number')).to eq('17') expect(champ_value_for('decimal_number')).to eq('17')
expect(champ_value_for('integer_number')).to eq('12') expect(champ_value_for('integer_number')).to eq('12')
expect(champ_value_for('checkbox')).to eq('true') expect(champ_value_for('checkbox')).to eq('true')
@ -84,7 +84,7 @@ describe 'The user' do
expect(page).to have_field('textarea', with: 'super textarea') expect(page).to have_field('textarea', with: 'super textarea')
expect(page).to have_field('date', with: '2012-12-12') expect(page).to have_field('date', with: '2012-12-12')
expect(page).to have_field('datetime', with: '2023-01-06T07:05') expect(page).to have_field('datetime', with: '2023-01-06T07:05')
expect(page).to have_field('number', with: '42') # expect(page).to have_field('number', with: '42'), deadchamp, should be migrated to textchamp
expect(page).to have_checked_field('checkbox') expect(page).to have_checked_field('checkbox')
expect(page).to have_checked_field('Madame') expect(page).to have_checked_field('Madame')
expect(page).to have_field('email', with: 'loulou@yopmail.com') expect(page).to have_field('email', with: 'loulou@yopmail.com')