Bugzilla – Attachment 188547 Details for
Bug 41128
ratings.js creating "undefined" text for screen readers and print output
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41128: Only use data rating if it's available
Bug-41128-Only-use-data-rating-if-its-available.patch (text/plain), 1.52 KB, created by
Owen Leonard
on 2025-10-29 12:18:49 UTC
(
hide
)
Description:
Bug 41128: Only use data rating if it's available
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-10-29 12:18:49 UTC
Size:
1.52 KB
patch
obsolete
>From a3e341c24093634647f24c8b6b8fb764a8b0d86c Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 29 Oct 2025 05:24:12 +0000 >Subject: [PATCH] Bug 41128: Only use data rating if it's available > >This patch prevents span elements being filled with "undefined" >which are then shown to screen readers and print output. > >Test plan: >0. Apply the patch >1. Enable the following system preference: OpacStarRatings (results, > details, and patron). >2. Check out an item to a user you can log in as (e.g. koha user) >3. Go to /cgi-bin/koha/opac-user.pl in the OPAC >4. Click "Print" on the toolbar above the summary table >5. Note that 5 occurrences of "undefined" do not appear next to the > title in the print output > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > koha-tmpl/opac-tmpl/bootstrap/js/ratings.js | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/ratings.js b/koha-tmpl/opac-tmpl/bootstrap/js/ratings.js >index 40ff854071e..a60fe2a81ab 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/ratings.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/ratings.js >@@ -70,7 +70,9 @@ $(document).ready(function () { > $(this).replaceWith(span); > } else { > var data_rating = $(this).attr("data-rating-value"); >- $(this).append('<span class="sr-only">' + data_rating + "</span>"); >+ if (data_rating){ >+ $(this).append('<span class="sr-only">' + data_rating + "</span>"); >+ } > } > }); > }); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41128
:
188544
|
188545
|
188547
|
188825