Use a button to show/hide password in the management area

When using a link, people using screen readers might think they're going
to a new page where the password is going to be shown. With a button,
they get a better idea about what to expect.

Furthermore, with a button, we can use the `aria-pressed` attribute to
indicate whether the password is currently being shown.
This commit is contained in:
Javi Martín
2025-02-26 08:57:30 +01:00
parent 5df85bac4e
commit 573f0e62cc
4 changed files with 13 additions and 7 deletions

View File

@@ -10,10 +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">
<button type="button" class="show-password" aria-pressed="false">
<span class="icon-eye"></span>
<span class="show-for-sr"><%= t("management.account.edit.password.show") %></span>
</a>
</button>
</span>
</div>