Bug 40612 - Eliminate duplicate element id in OPAC language menus
Summary: Eliminate duplicate element id in OPAC language menus
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Owen Leonard
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-07 15:51 UTC by Owen Leonard
Modified: 2025-09-25 16:30 UTC (History)
2 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.04
Circulation function:


Attachments
Bug 40612: Eliminate duplicate element id in OPAC language menus (2.73 KB, patch)
2025-08-07 15:58 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 40612: Eliminate duplicate element id in OPAC language menus (2.79 KB, patch)
2025-09-05 14:56 UTC, Lin Wei
Details | Diff | Splinter Review
Bug 40612: Eliminate duplicate element id in OPAC language menus (2.86 KB, patch)
2025-09-16 10:24 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2025-08-07 15:51:01 UTC
If you have OpacLangSelectorMode set to "both" the page will have a duplicate id because the same menu include is used in the header and the footer.
Comment 1 Owen Leonard 2025-08-07 15:58:26 UTC
Created attachment 185229 [details] [review]
Bug 40612: Eliminate duplicate element id in OPAC language menus

This patch updates the include file used to display the OPAC language
menu in the header and footer. The include already makes use of a
"context" variable which tells it whether it's in the header or footer.
We can use the same logic to give unique ids for each instance.

To test, apply the patch and rebuild the OPAC CSS.

- Go to Administration -> System preferences -> OpacLangSelectorMode and
  set it to "both top and footer."
- Go to the OPAC and inspect the HTML for each language menu. The one in
  the header should have the id "header_langmenu." The one in the footer
  should have "footer_langmenu."

Sponsored-by: Athens County Public Libraries
Comment 2 Lin Wei 2025-09-05 14:56:26 UTC
Created attachment 186229 [details] [review]
Bug 40612: Eliminate duplicate element id in OPAC language menus

This patch updates the include file used to display the OPAC language
menu in the header and footer. The include already makes use of a
"context" variable which tells it whether it's in the header or footer.
We can use the same logic to give unique ids for each instance.

To test, apply the patch and rebuild the OPAC CSS.

- Go to Administration -> System preferences -> OpacLangSelectorMode and
  set it to "both top and footer."
- Go to the OPAC and inspect the HTML for each language menu. The one in
  the header should have the id "header_langmenu." The one in the footer
  should have "footer_langmenu."

Sponsored-by: Athens County Public Libraries
Signed-off-by: Ludovic Julien <ludovic.julien@inLibro.com>
Comment 3 Ludovic 2025-09-05 15:01:03 UTC
Tested and works perfectly, thank you!

This patch fixes a subtle but important issue. Having unique element IDs in HTML is not just a matter of clean code — it’s essential for accessibility, JavaScript functionality, and ensuring valid, predictable DOM behavior.

Thanks for catching and addressing this!
Small changes like this really contribute to a more solid and maintainable OPAC for everyone.
Comment 4 Jonathan Druart 2025-09-16 10:24:05 UTC
Created attachment 186471 [details] [review]
Bug 40612: Eliminate duplicate element id in OPAC language menus

This patch updates the include file used to display the OPAC language
menu in the header and footer. The include already makes use of a
"context" variable which tells it whether it's in the header or footer.
We can use the same logic to give unique ids for each instance.

To test, apply the patch and rebuild the OPAC CSS.

- Go to Administration -> System preferences -> OpacLangSelectorMode and
  set it to "both top and footer."
- Go to the OPAC and inspect the HTML for each language menu. The one in
  the header should have the id "header_langmenu." The one in the footer
  should have "footer_langmenu."

Sponsored-by: Athens County Public Libraries
Signed-off-by: Ludovic Julien <ludovic.julien@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Lucas Gass (lukeg) 2025-09-18 19:54:16 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Paul Derscheid 2025-09-25 16:30:18 UTC
Nice work everyone!

Pushed to 25.05.x