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: <a href="#" class="show-password">
          <span class="icon-eye"></span>
        </a>
  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
```
This commit is contained in:
Javi Martín
2025-02-26 08:53:29 +01:00
parent 248b826f20
commit a1bdaf6e8f
4 changed files with 16 additions and 1 deletions

View File

@@ -10,7 +10,10 @@
<div class="input-group">
<%= f.password_field :password, class: "input-group-field", label: false, value: nil %>
<span class="input-group-label">
<a href="#" class="show-password"><span class="icon-eye"></span></a>
<a href="#" class="show-password">
<span class="icon-eye"></span>
<span class="show-for-sr"><%= t("management.account.edit.password.show") %></span>
</a>
</span>
</div>

View File

@@ -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:

View File

@@ -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:

View File

@@ -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"