Bug 38948

Summary: Modal error on some pages: Can't access property "backdrop"
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 35402    
Bug Blocks:    

Description Owen Leonard 2025-01-22 17:24:17 UTC
I know I've seen this in more than one place, but I've just confirmed that it appears in the console on the item add/edit page:

Uncaught TypeError: can't access property "backdrop", this._config is undefined
    _initializeBackDrop http://127.0.0.1:8081/intranet-tmpl/lib/bootstrap/bootstrap.bundle.min_24.1200003.js:6
    On http://127.0.0.1:8081/intranet-tmpl/lib/bootstrap/bootstrap.bundle.min_24.1200003.js:6
    <anonymous> http://127.0.0.1:8081/intranet-tmpl/prog/js/cookieconsent_24.1200003.js:20
    <anonymous> http://127.0.0.1:8081/intranet-tmpl/prog/js/cookieconsent_24.1200003.js:197
bootstrap.bundle.min_24.1200003.js:6:52582

I think it's new since the Bootstrap 5 upgrade. Some web searches turn up information like "The problem is that the Modal has not been loaded into the DOM at this stage and therefore is undefined when the getElementById action is performed. The solution was to wait until the DOM is loaded."

This would make sense considering the add/edit item page is one of those pages where the JS is loaded at the top of the page rather than the bottom.
Comment 1 Jonathan Druart 2025-02-11 12:51:53 UTC
Using Firefox, I am seeing:

Loading failed for the <script> with source “http://localhost:8081/intranet-tmpl/prog/js/cookieconsent_24.1200008.js”.

Trying to recreate the problem I've only turned on CookieConsent and hit http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1

Not sure if it's the same problem we are seeing?