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 var $summaries = $details.find('> summary');
19 function detailsToggle(matches) {
21 $details.attr('open', true);
22 $summaries.attr('aria-expanded', true);
23 $summaries.on('click.details-open', false);
25 var $notPressed = $details.find('> summary[aria-pressed!=true]').attr('aria-expanded', false);
26 $notPressed.parent('details').attr('open', false);
28 $summaries.off('.details-open');
32 function handleDetailsMQ(event) {
33 detailsToggle(event.matches);
36 var mql = window.matchMedia('(min-width:48em)');
37 mql.addListener(handleDetailsMQ);
38 detailsToggle(mql.matches);