details-aria.js 606 B

12345678910111213141516171819202122
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal) {
  8. Drupal.behaviors.detailsAria = {
  9. attach: function attach() {
  10. $('body').once('detailsAria').on('click.detailsAria', 'summary', function (event) {
  11. var $summary = $(event.currentTarget);
  12. var open = $(event.currentTarget.parentNode).attr('open') === 'open' ? 'false' : 'true';
  13. $summary.attr({
  14. 'aria-expanded': open,
  15. 'aria-pressed': open
  16. });
  17. });
  18. }
  19. };
  20. })(jQuery, Drupal);