From b2dd6bcc164091824a094ff735f8b3df738d967e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 25 Aug 2021 23:32:17 +0200 Subject: [PATCH] Remove placeholder in SDG related list Its value is difficult to read due to the low contrast between the color of the field and the color of the placeholder text, and we already have the same information in the hint above it. --- app/assets/javascripts/sdg/related_list_selector.js | 6 ++++++ app/components/sdg/related_list_selector_component.html.erb | 1 - config/locales/en/sdg.yml | 1 - config/locales/es/sdg.yml | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/sdg/related_list_selector.js b/app/assets/javascripts/sdg/related_list_selector.js index f36c1f7b9..6f0695fe3 100644 --- a/app/assets/javascripts/sdg/related_list_selector.js +++ b/app/assets/javascripts/sdg/related_list_selector.js @@ -89,6 +89,12 @@ suggestions_input[0].id = original_input[0].id + "_suggestions"; $("[for='" + original_input[0].id + "']").attr("for", suggestions_input[0].id); + + suggestions_input.attr("aria-describedby", original_input.attr("aria-describedby")); + + if ($(original_input).attr("placeholder") === undefined) { + suggestions_input.removeAttr("placeholder"); + } } }; }).call(this); diff --git a/app/components/sdg/related_list_selector_component.html.erb b/app/components/sdg/related_list_selector_component.html.erb index 4d8135b57..36fe5a0ba 100644 --- a/app/components/sdg/related_list_selector_component.html.erb +++ b/app/components/sdg/related_list_selector_component.html.erb @@ -13,7 +13,6 @@ <%= f.text_field :related_sdg_list, class: "input", - placeholder: t("sdg.related_list_selector.placeholder"), hint: sanitize(t("sdg.related_list_selector.hint", link: link_to(t("sdg.related_list_selector.help.text"), sdg_help_path, diff --git a/config/locales/en/sdg.yml b/config/locales/en/sdg.yml index c94d185a3..d68aacb0c 100644 --- a/config/locales/en/sdg.yml +++ b/config/locales/en/sdg.yml @@ -632,7 +632,6 @@ en: title: "Which SDGs and targets are aligned with my %{record}?" text: "SDG help page" hint: You can introduce the code of a specific goal/target or a text to find one. For more information visit the %{link}. - placeholder: "Write a goal or target code or description" remove_tag: "Remove" title: "Sustainable Development Goals and Targets" targets: diff --git a/config/locales/es/sdg.yml b/config/locales/es/sdg.yml index 1a32f47a2..e0a7e44c0 100644 --- a/config/locales/es/sdg.yml +++ b/config/locales/es/sdg.yml @@ -632,7 +632,6 @@ es: title: "¿Qué ODS y metas se alinean con mi %{record}?" text: "página de ayuda de ODS" hint: Puedes introducir el código de un objetivo/meta específico o un texto para encontrar uno. Para más información visita la %{link}. - placeholder: "Escribe las etiquetas que desees" remove_tag: "Eliminar" title: "Objetivos de Desarrollo Sostenible y Metas" targets: