2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function ($, Drupal) {
9 Drupal.behaviors.responsiveDetails = {
10 attach: function attach(context) {
11 var $details = $(context).find('details').once('responsive-details');
13 if (!$details.length) {
17 function detailsToggle(matches) {
19 $details.attr('open', true);
20 $summaries.attr('aria-expanded', true);
21 $summaries.on('click.details-open', false);
23 var $notPressed = $details.find('> summary[aria-pressed!=true]').attr('aria-expanded', false);
24 $notPressed.parent('details').attr('open', false);
26 $summaries.off('.details-open');
30 function handleDetailsMQ(event) {
31 detailsToggle(event.matches);
34 var $summaries = $details.find('> summary');
35 var mql = window.matchMedia('(min-width:48em)');
36 mql.addListener(handleDetailsMQ);
37 detailsToggle(mql.matches);