Bug 30699

Summary: Fix various HTML validity errors in staff interface templates
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: Pushed to main --- QA Contact: Aleisha Amohia <aleisha>
Severity: minor    
Priority: P5 - low CC: aleisha, dcook
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27546
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Attachments: Bug 30699: Fix various HTML validity errors in staff interface templates
Bug 30699: Fix various HTML validity errors in staff interface templates
Bug 30699: Fix various HTML validity errors in staff interface templates
Bug 30699: (follow-up) Update to fix selenium test

Description Fridolin Somers 2022-05-05 21:50:54 UTC
In koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc there is :
  <select class="advsearch" name="idx" id="idx">
But this include is used several times, so there are several id="idx".
We should remove this id.
Comment 1 Fridolin Somers 2023-03-29 08:20:08 UTC
Arf this is now used for id=refiner_idx from Bug 27546
Comment 2 David Cook 2023-03-29 23:27:45 UTC
Got to love these little gotchas...
Comment 3 Fridolin Somers 2023-09-12 18:05:16 UTC
This is bad right ?
Comment 4 David Cook 2023-09-12 23:15:34 UTC
(In reply to Fridolin Somers from comment #3)
> This is bad right ?

It's not good.
Comment 5 Owen Leonard 2024-08-30 17:52:07 UTC
Some other errors I'll submit a fix for: More duplicate id problems, tab WRAPPER errors, invalid "href" attributes on <button>s, mismatched labels and form field ids.
Comment 6 Owen Leonard 2024-08-30 17:58:15 UTC
Created attachment 170923 [details] [review]
Bug 30699: Fix various HTML validity errors in staff interface templates

This patch fixes several HTML validity issues in various staff
interface templates. Most of these changes won't be visible in the
interface.

- Advanced search:
  - Remove stray </a> tags
  - Fix duplicate IDs by adding loop.index to repeated dropdown menus
- Circulation
  - Fix mismatched label and form field id in checkouts table footer
  - Fix mismatched label and form field id claim returned modal
  - Remove invalid href attribute from button in claim returned modal
  - Wrap relatives' checkouts tab in conditional so that panel doesn't
    appear when tab has been hidden
  - Fix duplicate id attributes in patron messages-related markup
  - Remove redundant class attribute from patron messages-related markup
- Acquisitions -> Vendor -> Basket -> Add to basket -> From staged file
  - Remove invalid "size" attribute from hidden form fields
- Circulation -> Holds awaiting pickup
  - Fix mismatched label and form field id
- Patron -> Accounting -> Pay fine -> Submit cash amount higher than the
  charge
  - Remove invalid href attribute from button in confirmation modal
- Fix errors in tab markup WRAPPERs in html_helpers.inc to prevent
  mismatched aria-labelledby attributes
- Footer language selector:
  - Fix markup to correct errors in aria-controls
- Remove invalid href attribute from cookie consent modal

Sponsored-by: Athens County Public Libraries
Comment 7 Phil Ringnalda 2024-10-11 00:17:38 UTC
Created attachment 172679 [details] [review]
Bug 30699: Fix various HTML validity errors in staff interface templates

This patch fixes several HTML validity issues in various staff
interface templates. Most of these changes won't be visible in the
interface.

- Advanced search:
  - Remove stray </a> tags
  - Fix duplicate IDs by adding loop.index to repeated dropdown menus
- Circulation
  - Fix mismatched label and form field id in checkouts table footer
  - Fix mismatched label and form field id claim returned modal
  - Remove invalid href attribute from button in claim returned modal
  - Wrap relatives' checkouts tab in conditional so that panel doesn't
    appear when tab has been hidden
  - Fix duplicate id attributes in patron messages-related markup
  - Remove redundant class attribute from patron messages-related markup
- Acquisitions -> Vendor -> Basket -> Add to basket -> From staged file
  - Remove invalid "size" attribute from hidden form fields
- Circulation -> Holds awaiting pickup
  - Fix mismatched label and form field id
- Patron -> Accounting -> Pay fine -> Submit cash amount higher than the
  charge
  - Remove invalid href attribute from button in confirmation modal
- Fix errors in tab markup WRAPPERs in html_helpers.inc to prevent
  mismatched aria-labelledby attributes
- Footer language selector:
  - Fix markup to correct errors in aria-controls
- Remove invalid href attribute from cookie consent modal

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 8 Aleisha Amohia 2024-11-06 03:47:58 UTC
Created attachment 174064 [details] [review]
Bug 30699: Fix various HTML validity errors in staff interface templates

This patch fixes several HTML validity issues in various staff
interface templates. Most of these changes won't be visible in the
interface.

- Advanced search:
  - Remove stray </a> tags
  - Fix duplicate IDs by adding loop.index to repeated dropdown menus
- Circulation
  - Fix mismatched label and form field id in checkouts table footer
  - Fix mismatched label and form field id claim returned modal
  - Remove invalid href attribute from button in claim returned modal
  - Wrap relatives' checkouts tab in conditional so that panel doesn't
    appear when tab has been hidden
  - Fix duplicate id attributes in patron messages-related markup
  - Remove redundant class attribute from patron messages-related markup
- Acquisitions -> Vendor -> Basket -> Add to basket -> From staged file
  - Remove invalid "size" attribute from hidden form fields
- Circulation -> Holds awaiting pickup
  - Fix mismatched label and form field id
- Patron -> Accounting -> Pay fine -> Submit cash amount higher than the
  charge
  - Remove invalid href attribute from button in confirmation modal
- Fix errors in tab markup WRAPPERs in html_helpers.inc to prevent
  mismatched aria-labelledby attributes
- Footer language selector:
  - Fix markup to correct errors in aria-controls
- Remove invalid href attribute from cookie consent modal

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Comment 9 Katrin Fischer 2024-11-07 17:51:12 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 10 Katrin Fischer 2024-11-08 09:53:05 UTC
This change broke the selenium tests, but I am not sure if we should fix the template or the tests:


                        <li data-bs-toggle="tooltip" data-bs-placement="left" title="Patron is an adult">
                            <a class="dropdown-item disabled" aria-disabled="true" id="updatechild" href="#">Update child to adult patron</a>
                            <button class="dropdown-item disabled" aria-disabled="true" id="updatechild">Update child to adult patron</button>



prove t/db_dependent/selenium/update_child_to_adult.t 
t/db_dependent/selenium/update_child_to_adult.t .. 
STRACE:	/usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...} 
	/usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
	(eval 2011):1 in Selenium::Remote::Driver::__ANON__
	(eval 2013):2 in Selenium::Remote::Driver::__ANON__
	/usr/share/perl5/Selenium/Remote/Driver.pm:1340 in Selenium::Remote::Driver::_execute_command
	/usr/share/perl5/Selenium/Remote/Driver.pm:1340 in (eval)
	t/db_dependent/selenium/update_child_to_adult.t:141 in Selenium::Remote::Driver::find_element
	/usr/share/perl/5.36/Test/Builder.pm:374 in main::__ANON__
	/usr/share/perl/5.36/Test/Builder.pm:374 in (eval)
	/usr/share/perl/5.36/Test/More.pm:809 in Test::Builder::subtest
	t/db_dependent/selenium/update_child_to_adult.t:145 in Test::More::subtest
	/usr/share/perl/5.36/Test/Builder.pm:374 in main::__ANON__
	/usr/share/perl/5.36/Test/Builder.pm:374 in (eval)
	/usr/share/perl/5.36/Test/More.pm:809 in Test::Builder::subtest
	t/db_dependent/selenium/update_child_to_adult.t:153 in Test::More::subtest

        # No tests run!

    #   Failed test 'No tests run for subtest "Cannot update an adult"'
    #   at t/db_dependent/selenium/update_child_to_adult.t line 145.
    # Looks like you failed 1 test of 3.
t/db_dependent/selenium/update_child_to_adult.t .. 1/1 
#   Failed test 'Update child to patron'
#   at t/db_dependent/selenium/update_child_to_adult.t line 153.
Error while executing command: no such element: Unable to locate element: //a[@id="updatechild"]/.. at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.
 at /usr/share/perl5/Selenium/Remote/Driver.pm line 356.
# Looks like your test exited with 255 just after 1.
t/db_dependent/selenium/update_child_to_adult.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/1 subtests 

Test Summary Report
-------------------
t/db_dependent/selenium/update_child_to_adult.t (Wstat: 65280 (exited 255) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
Files=1, Tests=1, 28 wallclock secs ( 0.02 usr  0.00 sys +  1.72 cusr  0.21 csys =  1.95 CPU)
Result: FAIL
Comment 11 Owen Leonard 2024-11-11 13:04:19 UTC
Created attachment 174323 [details] [review]
Bug 30699: (follow-up) Update to fix selenium test

Changing an <a> to a <button> breaks test, and changing *all* the
a#updatechild's to <button>s also breaks the test, so the simple
solution is to change the <button> back to <a>.
Comment 12 Katrin Fischer 2024-11-14 15:16:52 UTC
Follow-up was pushed to main.