diff --git a/core/misc/collapse.es6.js b/core/misc/collapse.es6.js index 7c6d40e..2f3a2a4 100644 --- a/core/misc/collapse.es6.js +++ b/core/misc/collapse.es6.js @@ -147,35 +147,38 @@ * @param {jQuery.Event} e * The event triggered. */ - const showGroupingElementChild = function (e) { - const $item = (e.type === 'click') ? $(e.currentTarget.hash) : $(`#${location.hash.substr(1)}`); + const showGroupingElementChild = (e) => { + const $item = e.type === 'click' ? $(e.currentTarget.hash) : $(`#${location.hash.substr(1)}`); if ($item.length) { - // Open all (nested) parent details and set aria attributes on the summary - // by triggering the click event listener in details-aria.js. + /** + * Open all (nested) parent details and set aria attributes on the summary + * by triggering the click event listener in details-aria.js. + */ $item.parents('details').not('[open]').find('> summary').trigger('click'); - // Loop over all (nested) parent vertical tabs and focus them in order - // to reveal the children. + /** + * Loop over all (nested) parent vertical tabs and focus them in order + * to reveal the children. + */ $item.parents('.vertical-tabs__pane').each((index, pane) => { $(pane).data('verticalTab').focus(); }); - // Clicking the anchor should set focus, but timing issues in Edge need this. - setTimeout(function() { - $item.focus(); + /** + * Clicking the anchor should set focus, but event timing issues in Edge + * require a timeout. + */ + setTimeout(() => { + $item.focus() }, 300, $item); } }; - /** - * Binds a listener on fragment links to handle clicks. - */ + // Binds a listener on fragment links to handle clicks. $(document).on('click.grouping-element-fragments', 'a[href^="#"]', showGroupingElementChild); - /** - * Binds a listener to handle location hash changes. - */ + // Binds a listener to handle location hash changes. $(window).on('hashchange.grouping-element-fragments', showGroupingElementChild); // Expose constructor in the public space.