From a1bdaf6e8f07cd683c2de2438f980d86e76cd5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 26 Feb 2025 08:53:29 +0100 Subject: [PATCH] Add a text to the show password link in management area We were using an icon for this link, but people who can't see the icon couldn't know what the link was about. Axe was reporting the following accessibility error: ``` link-name: Links must have discernible text (serious) https://dequeuniversity.com/rules/axe/4.10/link-name?application=axeAPI The following 1 node violate this rule: Selector: .show-password HTML: Fix all of the following: - Element is in tab order and does not have accessible text Fix any of the following: - Element does not have text that is visible to screen readers - aria-label attribute does not exist or is empty - aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty - Element has no title attribute ``` --- .../account/edit_password_manually_component.html.erb | 5 ++++- config/locales/en/management.yml | 1 + config/locales/es/management.yml | 1 + spec/system/management/account_spec.rb | 10 ++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/components/management/account/edit_password_manually_component.html.erb b/app/components/management/account/edit_password_manually_component.html.erb index 484974695..c59848e62 100644 --- a/app/components/management/account/edit_password_manually_component.html.erb +++ b/app/components/management/account/edit_password_manually_component.html.erb @@ -10,7 +10,10 @@
<%= f.password_field :password, class: "input-group-field", label: false, value: nil %> - + + + <%= t("management.account.edit.password.show") %> +
diff --git a/config/locales/en/management.yml b/config/locales/en/management.yml index 3cf7506a3..06e9ab967 100644 --- a/config/locales/en/management.yml +++ b/config/locales/en/management.yml @@ -18,6 +18,7 @@ en: reseted: Password reseted successfully random: Generate random password save: Save password + show: Show password print: Print password print_help: You will be able to print the password when it is saved. account_info: diff --git a/config/locales/es/management.yml b/config/locales/es/management.yml index 895268f16..e7510f6cc 100644 --- a/config/locales/es/management.yml +++ b/config/locales/es/management.yml @@ -18,6 +18,7 @@ es: reseted: Contraseña restablecida correctamente random: Generar contraseña aleatoria save: Guardar contraseña + show: Mostrar contraseña print: Imprimir contraseña print_help: Podrás imprimir la contraseña cuando se haya guardado. account_info: diff --git a/spec/system/management/account_spec.rb b/spec/system/management/account_spec.rb index 6802a711d..b2d219de0 100644 --- a/spec/system/management/account_spec.rb +++ b/spec/system/management/account_spec.rb @@ -59,6 +59,16 @@ describe "Account" do new_password = find_field("user_password").value + expect(page).to have_field "Password", type: :password + + click_link "Show password" + + expect(page).to have_field "Password", type: :text + + click_link "Show password" + + expect(page).to have_field "Password", type: :password + click_button "Save password" expect(page).to have_content "Password reseted successfully"