Bug 29960 - Remove Modernizr dependency in the OPAC
Summary: Remove Modernizr dependency in the OPAC
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 30045 10309
Blocks: 29603
  Show dependency treegraph
 
Reported: 2022-01-27 14:13 UTC by Owen Leonard
Modified: 2022-02-18 12:56 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch refactors the code around JavaScript-driven responsive behavior in the OPAC. The use of Modernizr removed as it is no longer needed. It also adds a missing entry for Enquire.js licensing on the About page.
Version(s) released in:
22.05.00


Attachments
Bug 29960: Remove Modernizr dependency in the OPAC (18.83 KB, patch)
2022-01-27 14:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29960: Remove Modernizr dependency in the OPAC (18.73 KB, patch)
2022-02-07 12:15 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29960: Remove Modernizr dependency in the OPAC (18.78 KB, patch)
2022-02-07 17:18 UTC, David Nind
Details | Diff | Splinter Review
Bug 29960: (follow-up) Include enquire.js in print slip template (1.59 KB, patch)
2022-02-11 12:54 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29960: Remove Modernizr dependency in the OPAC (18.82 KB, patch)
2022-02-14 17:36 UTC, David Nind
Details | Diff | Splinter Review
Bug 29960: (follow-up) Include enquire.js in print slip template (1.64 KB, patch)
2022-02-14 17:36 UTC, David Nind
Details | Diff | Splinter Review
Bug 29960: Remove Modernizr dependency in the OPAC (18.88 KB, patch)
2022-02-14 21:19 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 29960: (follow-up) Include enquire.js in print slip template (1.69 KB, patch)
2022-02-14 21:19 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2022-01-27 14:13:58 UTC
The OPAC has a little bit of JavaScript which depends on the browser's matchMedia API. At the time it was added, browsers didn't all support the API consistently. Modernizr was added to act as a polyfill to ensure compatibility.

Browsers have caught up (https://caniuse.com/?search=matchmedia) so the Modernizr dependency can be removed.
Comment 1 Owen Leonard 2022-01-27 14:37:12 UTC Comment hidden (obsolete)
Comment 2 David Nind 2022-02-04 18:34:34 UTC
Patch no longer applies 8-(...

Applying: Bug 29960: Remove Modernizr dependency in the OPAC
Using index info to reconstruct a base tree...
M	koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
M	koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
Falling back to patching base and 3-way merge...
Removing koha-tmpl/opac-tmpl/bootstrap/lib/modernizr.min.js
Removing koha-tmpl/opac-tmpl/bootstrap/js/script.js
Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
CONFLICT (content): Merge conflict in koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
error: Failed to merge in the changes.
Patch failed at 0001 Bug 29960: Remove Modernizr dependency in the OPAC
Comment 3 Owen Leonard 2022-02-07 12:15:40 UTC Comment hidden (obsolete)
Comment 4 David Nind 2022-02-07 17:18:37 UTC
Created attachment 130243 [details] [review]
Bug 29960: Remove Modernizr dependency in the OPAC

This patch refactors the code around JavaScript-driven responsive
behavior in the OPAC. The use of Modernizr dropped and the dependency
removed.

This patch also adds a missing listing for Enquire.js licensing on the
"About" page.

To test, apply the patch and perform a catalog search in the OPAC.

- Narrow your browser window until its width falls below 609 pixels
  (Using your browser's Responsive Design Mode is helpful for this, e.g.
  https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode)
- The window should automatically scroll to the "main content" area, in
  this case the section headed by "Your search returned..."

- Change your browser window's width until it falls below 768 pixels.
- Scroll to the bottom of the search results where you should find the
  "Refine your search" facets box collapsed.
- As you increase your browser width above 768 pixels the facets box
  should expand.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Katrin Fischer 2022-02-07 22:04:45 UTC
I am having these in the QA test tools:

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
   FAIL	  valid_template
		Attempt to reload Koha/Template/Plugin/Branches.pm aborted.
Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl5/5.32/Template/Plugins.pm line 206.



 OK	koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
 FAIL	koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
   FAIL	  valid_template
		Attempt to reload Koha/Template/Plugin/AdditionalContents.pm aborted.
Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl5/5.32/Template/Plugins.pm line 206.
Comment 6 Katrin Fischer 2022-02-07 22:05:53 UTC
(In reply to Katrin Fischer from comment #5)
> I am having these in the QA test tools:
> 
>  FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
>    FAIL	  valid_template
> 		Attempt to reload Koha/Template/Plugin/Branches.pm aborted.
> Compilation failed in require at
> /usr/lib/x86_64-linux-gnu/perl5/5.32/Template/Plugins.pm line 206.
> 
> 
> 
>  OK	koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
>  FAIL	koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
>    FAIL	  valid_template
> 		Attempt to reload Koha/Template/Plugin/AdditionalContents.pm aborted.
> Compilation failed in require at
> /usr/lib/x86_64-linux-gnu/perl5/5.32/Template/Plugins.pm line 206.

These appear unrelated to the patch, wondering if something is broken in master?
Comment 7 Jonathan Druart 2022-02-08 09:39:56 UTC
I am expecting sco print slip to be broken, 'enquire' won't be defined in global.js when included from sco/printslip.tt.
But the print slip feature is broken in master right now.
Comment 8 Jonathan Druart 2022-02-08 11:22:37 UTC
(In reply to Jonathan Druart from comment #7)
> I am expecting sco print slip to be broken, 'enquire' won't be defined in
> global.js when included from sco/printslip.tt.
> But the print slip feature is broken in master right now.

Confirmed, "Uncaught ReferenceError: enquire is not defined". Tested on top of bug 30045
Comment 9 Owen Leonard 2022-02-11 12:54:35 UTC
Created attachment 130489 [details] [review]
Bug 29960: (follow-up) Include enquire.js in print slip template

This patch adds enquire.js to the print slip template in order to
prevent a JS error.

Also removed is a line from global.js which was added in the previous
patch and which was an unwanted change.
Comment 10 David Nind 2022-02-14 17:36:23 UTC
Created attachment 130554 [details] [review]
Bug 29960: Remove Modernizr dependency in the OPAC

This patch refactors the code around JavaScript-driven responsive
behavior in the OPAC. The use of Modernizr dropped and the dependency
removed.

This patch also adds a missing listing for Enquire.js licensing on the
"About" page.

To test, apply the patch and perform a catalog search in the OPAC.

- Narrow your browser window until its width falls below 609 pixels
  (Using your browser's Responsive Design Mode is helpful for this, e.g.
  https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode)
- The window should automatically scroll to the "main content" area, in
  this case the section headed by "Your search returned..."

- Change your browser window's width until it falls below 768 pixels.
- Scroll to the bottom of the search results where you should find the
  "Refine your search" facets box collapsed.
- As you increase your browser width above 768 pixels the facets box
  should expand.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2022-02-14 17:36:28 UTC
Created attachment 130555 [details] [review]
Bug 29960: (follow-up) Include enquire.js in print slip template

This patch adds enquire.js to the print slip template in order to
prevent a JS error.

Also removed is a line from global.js which was added in the previous
patch and which was an unwanted change.

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 Katrin Fischer 2022-02-14 21:19:44 UTC
Created attachment 130576 [details] [review]
Bug 29960: Remove Modernizr dependency in the OPAC

This patch refactors the code around JavaScript-driven responsive
behavior in the OPAC. The use of Modernizr dropped and the dependency
removed.

This patch also adds a missing listing for Enquire.js licensing on the
"About" page.

To test, apply the patch and perform a catalog search in the OPAC.

- Narrow your browser window until its width falls below 609 pixels
  (Using your browser's Responsive Design Mode is helpful for this, e.g.
  https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode)
- The window should automatically scroll to the "main content" area, in
  this case the section headed by "Your search returned..."

- Change your browser window's width until it falls below 768 pixels.
- Scroll to the bottom of the search results where you should find the
  "Refine your search" facets box collapsed.
- As you increase your browser width above 768 pixels the facets box
  should expand.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2022-02-14 21:19:48 UTC
Created attachment 130577 [details] [review]
Bug 29960: (follow-up) Include enquire.js in print slip template

This patch adds enquire.js to the print slip template in order to
prevent a JS error.

Also removed is a line from global.js which was added in the previous
patch and which was an unwanted change.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Fridolin Somers 2022-02-17 07:52:52 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄