diff --git a/core/themes/seven/js/responsive-details.js b/core/themes/seven/js/responsive-details.js index 6d1787b..a98aede 100644 --- a/core/themes/seven/js/responsive-details.js +++ b/core/themes/seven/js/responsive-details.js @@ -3,7 +3,7 @@ * Provides responsive behaviors to HTML details elements. */ -(function ($, Drupal) { +(function ($, Drupal, debounce) { 'use strict'; @@ -17,22 +17,26 @@ */ Drupal.behaviors.responsiveDetails = { attach: function (context) { - var $statusDetails = $(context).find('.system-status-report__entry'); + var $statusDetails = $(context).find('details').once('responsive-details'); function handleResize() { if (window.matchMedia('(min-width:48em)').matches) { - $statusDetails.attr('open', true); + $statusDetails + .attr('open', true) + .children('summary') + .attr('aria-expanded', true); } else { // If user explicitly opened one, leave it alone. $statusDetails.find('summary[aria-pressed!=true]') + .attr('aria-expanded', false) .parent('details') .attr('open', false); } } - $(window).on('resize.details', Drupal.debounce(handleResize, 150)).trigger('resize.details'); + $(window).on('resize.details', debounce(handleResize, 150)).trigger('resize.details'); } }; -})(jQuery, Drupal); +})(jQuery, Drupal, Drupal.debounce); diff --git a/core/themes/seven/seven.libraries.yml b/core/themes/seven/seven.libraries.yml index 1b05ab2..d78a103 100644 --- a/core/themes/seven/seven.libraries.yml +++ b/core/themes/seven/seven.libraries.yml @@ -84,6 +84,7 @@ drupal.responsive-detail: dependencies: - core/matchmedia - core/jquery + - core/jquery.once - core/drupal.debounce vertical-tabs: