[Bug 32926] New: Cannot expand or collapse some System preference sections after a search
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Bug ID: 32926 Summary: Cannot expand or collapse some System preference sections after a search Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: a.roussos@dataly.gr QA Contact: testopia@bugs.koha-community.org If you perform a System preferences search for a common word such as "type" or "log", you then lose the ability to expand or collapse the sections with names that appear more than once in the results page. All sections except the first one in each group of duplicates are affected by this. When you click on the 2nd, 3rd, etc. occurence of a section, the expand/collapse arrow does change, but in reality only the section that appears first in the page is actually toggled. I have created an animated GIF that shows this in action: https://imgur.com/a/NSslIcV This affects Koha 20.11.00 or later; `git bisect` tells me that the relevant commit is 9d890c7636ef1d6ec0a1de2161906fd9f4375e97 from Bug 23410. To reproduce: Perform a System preferences search for a common word such as "type" or "log". In the results page, the "Policy" section will appear more than once. Now try to expand/collapse any "Policy" section but the first one. It won't work, only the first "Policy" section is toggled. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Alias| |Non-unique, HTML, <h3>, | |heading, ids, in, System, | |preferences, search, | |results Assignee|oleonard@myacpl.org |a.roussos@dataly.gr URL| |admin/preferences.pl See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=3599, | |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=23410 --- Comment #1 from Andreas Roussos <a.roussos@dataly.gr> --- This is happening because the page does not have unique ids for the <h3> elements. To see for yourself, perform the steps to reproduce, then open your web browser's Developer Tools (F12 key). Now copy/paste the following code [*] in the JavaScript console and press <ENTER>: ids = Array.from(document.querySelectorAll('h3[id]')) .map(v => v.id) .reduce((acc, v) => { acc[v] = (acc[v] || 0) + 1; return acc }, {}); dupes = Object.entries(ids) .filter(([key, value]) => value > 1); console.table(dupes); You should get a table in the console window similar to the one below: +---------+--------------+---+ | (index) | 0 | 1 | +---------+--------------+---+ | 0 | 'Features' | 3 | | 1 | 'Policy' | 2 | | 2 | 'Appearance' | 2 | +---------+--------------+---+ The table lists the <h3> ids that occur more than once in the DOM. The 2nd column is the actual id value and the last column is the number of occurences. Notice that the "Features" id occurs 3 times, while "Policy" and "Appearance" occur 2 times each. [*] Code adapted from https://stackoverflow.com/a/70373818 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Alias|<h3>, heading, HTML, ids, | |in, Non-unique, | |preferences, results, | |search, System | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #2 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 146440 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146440&action=edit Bug 32926: Assign unique ids to <h3> elements If you perform a System preferences search for a common word such as "type", you lose the ability to expand or collapse some sections. In particular, you cannot expand/collapse the sections with names that appear more than once in the results page. All sections except the first one in each group of duplicates are affected by this. See https://imgur.com/a/NSslIcV for a demo. This patch fixes that by prepending the <h3> ids with the top-level System preference section name to make them unique. Test plan: 1) Perform a System preferences search for a common word such as "type" or "log". In the results page, the "Policy" section will appear more than once. Now try to expand/collapse any "Policy" section but the first one. It won't work, only the first "Policy" section is toggled. 2) Apply this patch and refresh the page. 3) This time you should be able to expand or collapse all of the available system preference sections. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #3 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 146441 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146441&action=edit Bug 32926: Add Selenium tests This adds a new Selenium test to automatically test the correct behaviour when expanding/collapsing System preferences sections after a System preferences search. Test plan: 1) Apply the other patch from this bug report, then run the new Selenium unit test which should pass without failures: prove -v t/db_dependent/selenium/system_preferences_search.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #146441|0 |1 is obsolete| | --- Comment #4 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 146448 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146448&action=edit Bug 32926: Add Selenium tests This adds a new Selenium test to automatically test the correct behaviour when expanding/collapsing System preferences sections after a System preferences search. Test plan: 1) Apply the other patch from this bug report, then run the new Selenium unit test which should pass without failures: prove -v t/db_dependent/selenium/system_preferences_search.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #5 from Andreas Roussos <a.roussos@dataly.gr> --- Apologies, I somehow messed up the file permissions on the Selenium unit test file just before committing (644 instead of the correct 755). This has now been fixed and I've obsoleted my previous patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #6 from Fridolin Somers <fridolin.somers@biblibre.com> --- I've tested, works well. But this breaks the links "View all xxx preferences", which link to an id (ie #Policy). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |ASSIGNED --- Comment #7 from Andreas Roussos <a.roussos@dataly.gr> --- (In reply to Fridolin Somers from comment #6)
I've tested, works well. Thanks for the feedback, Fridolin.
But this breaks the links "View all xxx preferences", which link to an id (ie #Policy). Ah, well spotted! I will provide a follow-up patch.
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #146440|0 |1 is obsolete| | --- Comment #8 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 146852 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146852&action=edit Bug 32926: Assign unique ids to <h3> elements If you perform a System preferences search for a common word such as "type", you lose the ability to expand or collapse some sections. In particular, you cannot expand/collapse the sections with names that appear more than once in the results page. All sections except the first one in each group of duplicates are affected by this. See https://imgur.com/a/NSslIcV for a demo. This patch fixes that by prepending the <h3> ids with the top-level System preference section name to make them unique. Test plan: 1) Perform a System preferences search for a common word such as "type" or "log". In the results page, the "Policy" section will appear more than once. Now try to expand/collapse any "Policy" section but the first one. It won't work, only the first "Policy" section is toggled. 2) Apply this patch and refresh the page. 3) This time you should be able to expand or collapse all of the available system preference sections. 4) Clicking on the "View all xxx preferences" links on the right hand side should take you to the correct System preferences tab *and* automatically scroll the appropriate section into view at the top of the page. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #9 from Andreas Roussos <a.roussos@dataly.gr> --- (In reply to Andreas Roussos from comment #7)
Ah, well spotted! I will provide a follow-up patch. Actually, since this hasn't been signed off yet, I amended my previous patch and added an extra item to the test plan to cater for the issue that Fridolin has spotted.
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #146448|0 |1 is obsolete| | --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 146973 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146973&action=edit Bug 32926: Add Selenium tests This adds a new Selenium test to automatically test the correct behaviour when expanding/collapsing System preferences sections after a System preferences search. Test plan: 1) Apply the other patch from this bug report, then run the new Selenium unit test which should pass without failures: prove -v t/db_dependent/selenium/system_preferences_search.t Signed-off-by: Fridolin <fridolin.somers@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #146852|0 |1 is obsolete| | --- Comment #11 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 146974 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146974&action=edit Bug 32926: Assign unique ids to <h3> elements If you perform a System preferences search for a common word such as "type", you lose the ability to expand or collapse some sections. In particular, you cannot expand/collapse the sections with names that appear more than once in the results page. All sections except the first one in each group of duplicates are affected by this. See https://imgur.com/a/NSslIcV for a demo. This patch fixes that by prepending the <h3> ids with the top-level System preference section name to make them unique. Test plan: 1) Perform a System preferences search for a common word such as "type" or "log". In the results page, the "Policy" section will appear more than once. Now try to expand/collapse any "Policy" section but the first one. It won't work, only the first "Policy" section is toggled. 2) Apply this patch and refresh the page. 3) This time you should be able to expand or collapse all of the available system preference sections. 4) Clicking on the "View all xxx preferences" links on the right hand side should take you to the correct System preferences tab *and* automatically scroll the appropriate section into view at the top of the page. Signed-off-by: Fridolin <fridolin.somers@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #146973|0 |1 is obsolete| | --- Comment #12 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 147197 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=147197&action=edit Bug 32926: Add Selenium tests This adds a new Selenium test to automatically test the correct behaviour when expanding/collapsing System preferences sections after a System preferences search. Test plan: 1) Apply the other patch from this bug report, then run the new Selenium unit test which should pass without failures: prove -v t/db_dependent/selenium/system_preferences_search.t Signed-off-by: Fridolin <fridolin.somers@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #146974|0 |1 is obsolete| | --- Comment #13 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 147198 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=147198&action=edit Bug 32926: Assign unique ids to <h3> elements If you perform a System preferences search for a common word such as "type", you lose the ability to expand or collapse some sections. In particular, you cannot expand/collapse the sections with names that appear more than once in the results page. All sections except the first one in each group of duplicates are affected by this. See https://imgur.com/a/NSslIcV for a demo. This patch fixes that by prepending the <h3> ids with the top-level System preference section name to make them unique. Test plan: 1) Perform a System preferences search for a common word such as "type" or "log". In the results page, the "Policy" section will appear more than once. Now try to expand/collapse any "Policy" section but the first one. It won't work, only the first "Policy" section is toggled. 2) Apply this patch and refresh the page. 3) This time you should be able to expand or collapse all of the available system preference sections. 4) Clicking on the "View all xxx preferences" links on the right hand side should take you to the correct System preferences tab *and* automatically scroll the appropriate section into view at the top of the page. Signed-off-by: Fridolin <fridolin.somers@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #14 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 147199 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=147199&action=edit Bug 32926: Fix selenium tests We should not rely on existing data, and we should remove data at the end. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.05. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.05.00 |23.05.00,22.11.04 released in| | Status|Pushed to master |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #16 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Nice work everyone! Pushed to stable for 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Version(s)|23.05.00,22.11.04 |23.05.00,22.11.04,22.05.11 released in| | Status|Pushed to stable |Pushed to oldstable --- Comment #17 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 22.05.x for upcoming 22.05.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.suzuki@biblibre.com Version(s)|23.05.00,22.11.04,22.05.11 |23.05.00,22.11.04,22.05.11, released in| |21.11.19 Status|Pushed to oldstable |Pushed to oldoldstable --- Comment #18 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- applied to 21.11 for 21.11.19 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 wainuiwitikapark@catalyst.net.nz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #19 from wainuiwitikapark@catalyst.net.nz --- Not backported to 21.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #20 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Created attachment 150739 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150739&action=edit Bug 32926: Restore scroll to sub-tab Test plan: Go to sys prefs, click 'Enhanced Content' Click 'OverDrive', notice it doesnt scroll there Apply this patch: Do the same test plan, but notice it does scroll there, like before -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |additional_work_needed CC| |martin.renvoize@ptfs-europe | |.com, | |pedro.amorim@ptfs-europe.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |33687 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33687 [Bug 33687] Clicking on a sys pref sub-menu item does not scroll to that item -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|additional_work_needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150739|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 --- Comment #21 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Made patch obsolete, opened bug 33687 instead. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |33634 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33634 [Bug 33634] Sidebar navigation links in system preferences not taking user to the clicked section -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32926 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |34655 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34655 [Bug 34655] system_preferences_search.t is failing randomly -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org