Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The drupal.collapse library is disabled in bootstrap.info.yml:
# ...
libraries-override:
core/drupal.batch: bootstrap/drupal.batch
core/drupal.collapse: false
# ...
So the <details>
elements will not receive core's polyfill and aria assets, defined in drupal.collapse.
Bootstrap has a js/misc/collapse.js asset, but it is not added in info.yml or libraries.yml, so it does not load anywhere.
Proposed resolution
Override core collapse.js with Bootstrap's version:
libraries-override:
core/drupal.collapse:
js:
misc/collapse.js: js/misc/collapse.js
Comment | File | Size | Author |
---|---|---|---|
#2 | details-closed.png | 19.36 KB | develdru |
#2 | details-closed.png | 19.36 KB | develdru |
Comments
Comment #2
develdru CreditAttribution: develdru as a volunteer and at OpenSense Labs commented@gpap the details tag is showing a collapsible content even if the drupal collapse is set to false. It is taking default functionality of html5.
more in the screenshots.
With your code, I don't see any change.
Comment #3
markhalliwellThis is actually just legacy cruft that needs to be cleaned up from when we were porting to 8.x.
The custom
collapse.js
file in the project doesn't need to be in there at allThe Bootstrap Framework nor this project uses
<details>
or<fieldset>
for it's collapsible markup.Thus, if for whatever reason, someone decides to disable a bootstrap panel on an element and it gets rendered as a normal core
<details>
, then yes... this would cause problems because it's currently disabling the entire library, even though this project doesn't use it anyway.I'll commit a fix shortly.
Comment #4
markhalliwell.