From 2c5619960ef72fbe7fe77513debbbc3542bdf279 Mon Sep 17 00:00:00 2001 From: Olivia Simonet <olivia.simonet@mmibordeaux.com> Date: Tue, 14 Jun 2022 12:41:22 +0200 Subject: [PATCH] Accessibility check for embed & CTA --- app/models/communication/block/template/call_to_action.rb | 5 +++++ app/models/communication/block/template/embed.rb | 6 ++++++ app/models/communication/block/template/gallery/image.rb | 6 ++++++ app/models/communication/block/template/image.rb | 5 +++++ .../communication/blocks/templates/gallery/_edit.html.erb | 4 +++- config/locales/fr.yml | 8 ++++++++ 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/models/communication/block/template/call_to_action.rb b/app/models/communication/block/template/call_to_action.rb index 867996d32..a16e87e65 100644 --- a/app/models/communication/block/template/call_to_action.rb +++ b/app/models/communication/block/template/call_to_action.rb @@ -7,4 +7,9 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ has_elements Communication::Block::Template::CallToAction::Button + def check_accessibility + super + accessibility_warning 'accessibility.commons.alt.empty' if image_component.blob && alt.blank? + end + end diff --git a/app/models/communication/block/template/embed.rb b/app/models/communication/block/template/embed.rb index c6eb762df..8f48cc8f3 100644 --- a/app/models/communication/block/template/embed.rb +++ b/app/models/communication/block/template/embed.rb @@ -4,4 +4,10 @@ class Communication::Block::Template::Embed < Communication::Block::Template::Ba has_component :iframe_title, :string has_component :transcription, :text + def check_accessibility + super + accessibility_error 'accessibility.blocks.templates.embed.title_missing' if iframe_title.blank? + accessibility_error 'accessibility.blocks.templates.embed.transcription_missing' if transcription.blank? + end + end diff --git a/app/models/communication/block/template/gallery/image.rb b/app/models/communication/block/template/gallery/image.rb index c46f4d3e9..2761a441b 100644 --- a/app/models/communication/block/template/gallery/image.rb +++ b/app/models/communication/block/template/gallery/image.rb @@ -7,4 +7,10 @@ class Communication::Block::Template::Gallery::Image < Communication::Block::Tem def blob image_component.blob end + + def check_accessibility + super + accessibility_warning 'accessibility.commons.alt.empty' if image_component.blob && alt.blank? + end + end diff --git a/app/models/communication/block/template/image.rb b/app/models/communication/block/template/image.rb index dea57cb13..ea534a890 100644 --- a/app/models/communication/block/template/image.rb +++ b/app/models/communication/block/template/image.rb @@ -5,4 +5,9 @@ class Communication::Block::Template::Image < Communication::Block::Template::Ba has_component :credit, :rich_text has_component :text, :text + def check_accessibility + super + accessibility_warning 'accessibility.commons.alt.empty' if image_component.blob && alt.blank? + end + end diff --git a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb index 5f59df06a..c685d8e13 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -21,7 +21,9 @@ </div> <div class="card-body"> <%= block_component_edit :image, - template: element %> + template: element, + label: t('admin.communication.blocks.components.image.input.label'), + placeholder: t('admin.communication.blocks.components.image.input.placeholder') %> <%= block_component_edit :alt, template: element, label: t('admin.communication.blocks.components.image.alt.label'), diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 52fa7ac49..e25d924fc 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -22,6 +22,14 @@ fr: transcription_missing: title: Pas de transcription text_html: La vidéo n'est pas accompagnée d'une transcription textuelle pour les personnes malvoyantes, ou pour les situations de faible débit qui empêcheraient la lecture. + embed: + title_missing: + title: Pas de titre de cadre + text_html: L'intégration HTML n'a pas de titre, cela va empêcher les personnes malvoyantes de savoir de quoi parle la vidéo, comme expliqué dans le <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">critère 4.7 du RGAA</a>. Merci d'ajouter un titre à la vidéo. + transcription_missing: + title: Pas de transcription + text_html: Le cadre HTML n'est pas accompagné d'une transcription textuelle pour les personnes malvoyantes, ou pour les situations de faible débit qui empêcheraient la lecture. + activerecord: attributes: -- GitLab