Bug 42229: Avoid using form labels for static values in opac-memberentry.tt

The OPAC personal details page uses <label> elements in some places
where no visible form control is present. In these cases, the content
is display-only and the label is not associated with an interactive
field.

Replace those labels with non-form markup for static values while
preserving existing labels for actual form controls.

Test plan:
1. Log in to the OPAC and go to the "Personal details" page
2. Inspect display-only values such as Username and Expiration date
3. Confirm <label> elements are used for content that is not part of a
   form control
4. Apply the patch
5. Log in to the OPAC and go to the "Personal details" page
6. Confirm display-only values such as Username and Expiration date no
   longer use <label> elements
7. Confirm other static display-only values updated by the patch also no
   longer use <label> elements
8. Confirm actual form controls, such as text inputs and selects, still
   have proper associated labels
9. Run an accessibility checker and confirm the related label misuse
   issues are resolved
10. Sign off and have a great day!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Laura_Escamilla 2026-04-02 20:59:57 +00:00 committed by Lucas Gass
parent a8e7087ce8
commit c416062ef0
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 5 additions and 6 deletions

View File

@ -267,9 +267,8 @@
<ol>
[% UNLESS hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) %]
<li>
<label for="borrower_cardnumber" class="[% required.cardnumber | html %]">Library card number:</label>
[% IF borrower && !(cardnumber_wrong_length || cardnumber_already_exists) && op == 'edit' %]
<span class="label">Library card number:</span>
[% borrower.cardnumber | html %]
[% ELSE %]
[% IF minlength_cardnumber == maxlength_cardnumber %]
@ -322,7 +321,7 @@
[% IF op != 'new' %]
[% UNLESS hidden.defined('userid') %]
<li>
<label>Username:</label>
<span class="label">Username:</span>
[% borrower.userid | html %]
</li>
[% END %]
@ -330,7 +329,7 @@
[% UNLESS hidden.defined('dateexpiry') %]
<li>
<label>Expiration date:</label>
<span class="label">Expiration date:</span>
[% borrower.dateexpiry | $KohaDates %]
</li>
[% END %]
@ -365,12 +364,12 @@
[% UNLESS hidden.defined('categorycode') %]
<li>
<label for="borrower_categorycode" class="[% required.categorycode | html %]"> Category:</label>
[% IF borrower %]
<span class="label">Category:</span>
[% Categories.GetName( borrower.categorycode ) | html %]
<input type="hidden" name="borrower_categorycode" value="[% borrower.categorycode | html %]" />
[% ELSE %]
<label for="borrower_categorycode" class="[% required.categorycode | html %]">Category:</label>
<select id="borrower_categorycode" name="borrower_categorycode" class="[% required.categorycode | html %]">
[% FOREACH c IN Categories.all() %]
[% IF c.categorycode == Koha.Preference('PatronSelfRegistrationDefaultCategory') %]