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
CommentFileSizeAuthor
#2 details-closed.png19.36 KBdeveldru
#2 details-closed.png19.36 KBdeveldru
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

gpap created an issue. See original summary.

develdru’s picture

FileSize
19.36 KB
19.36 KB

@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.

libraries-override:
  core/drupal.collapse:
    js:
      misc/collapse.js: js/misc/collapse.js
markcarver’s picture

Title: Fix drupal.collapse library override » Remove drupal.collapse library override and unused collapse.js
Version: 8.x-3.1 » 8.x-3.x-dev

This 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 all

The 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.

markcarver’s picture

Status: Active » Fixed

.

  • markcarver committed 15be4b2 on 8.x-3.x
    Issue #2840414 by markcarver, gpap: Remove drupal.collapse library...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.