| Summary: | ratings.js creating "undefined" text for screen readers and print output | ||
|---|---|---|---|
| Product: | Koha | Reporter: | David Cook <dcook> |
| Component: | OPAC | Assignee: | David Cook <dcook> |
| Status: | Pushed to main --- | QA Contact: | Paul Derscheid <paul.derscheid> |
| Severity: | minor | ||
| Priority: | P5 - low | CC: | paul.derscheid |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
25.11.00
|
|
| Circulation function: | |||
| Bug Depends on: | 39706 | ||
| Bug Blocks: | |||
| Attachments: |
Screenshot of "undefined" text in print output
Bug 41128: Only use data rating if it's available Bug 41128: Only use data rating if it's available Bug 41128: Only use data rating if it's available |
||
Created attachment 188544 [details]
Screenshot of "undefined" text in print output
Created attachment 188545 [details] [review] 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 Created attachment 188547 [details] [review] 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> Created attachment 188825 [details] [review] 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> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Nice work everyone! Pushed to main for 25.11 |
If you try to print the user summary table, you'll likely see a bunch of "undefined" text in the table. It looks like ./koha-tmpl/opac-tmpl/bootstrap/js/ratings.js iterates through some of the HTML and tries to create spans with text from the data-rating-value attribute, but that attribute doesn't exist, so it uses the text "undefined" instead: <div class="br-widget br-readonly"> <a href="#"><span class="sr-only">undefined</span></a> <a href="#"><span class="sr-only">undefined</span></a> <a href="#"><span class="sr-only">undefined</span></a> <a href="#"><span class="sr-only">undefined</span></a> <a href="#"><span class="sr-only">undefined</span></a> </div>