diff -u b/core/misc/form.es6.js b/core/misc/form.es6.js --- b/core/misc/form.es6.js +++ b/core/misc/form.es6.js @@ -265,13 +265,15 @@ * @fires event:formFragmentLinkClickOrHashChange */ const handleFragmentLinkClickOrHashChange = function triggerFragmentLinkClickOrChange(e) { - const $target = e.type === 'click' ? (e.currentTarget.location ? $(e.currentTarget.location.hash) : $(e.currentTarget.hash)) : $(`#${location.hash.substr(1)}`); + const $target = e.type === 'click' ? (e.currentTarget.location ? + $(e.currentTarget.location.hash) : $(e.currentTarget.hash)) : + $(`#${location.hash.substr(1)}`); $('body').trigger('formFragmentLinkClickOrHashChange', [$target]); /** - * Interaction with the page fragment should set focus, but event timing - * issues in multiple browsers require a timeout. + * Clicking a fragment link or a hash change should focus the target + * element, but event timing issues in multiple browsers require a timeout. */ setTimeout(() => { $target.focus(); @@ -279,7 +281,7 @@ }; // Binds a listener to handle URL fragment changes. - $(window).on('hashchange.form-fragment', debounce(handleFragmentLinkClickOrHashChange, 20)); + $(window).on('hashchange.form-fragment', debounce(handleFragmentLinkClickOrHashChange, 300, true)); /** * Binds a listener to handle clicks on fragment links and absolute URL links @@ -288,5 +290,5 @@ * is already in the URL. */ - $(document).on('click.form-fragment', 'a[href*="#"]', debounce(handleFragmentInteraction, 20)); + $(document).on('click.form-fragment', 'a[href*="#"]', debounce(handleFragmentLinkClickOrHashChange, 300, true)); }(jQuery, Drupal, Drupal.debounce)); diff -u b/core/misc/form.js b/core/misc/form.js --- b/core/misc/form.js +++ b/core/misc/form.js @@ -137,5 +137,5 @@ - $(window).on('hashchange.form-fragment', debounce(handleFragmentLinkClickOrHashChange, 20)); + $(window).on('hashchange.form-fragment', debounce(handleFragmentLinkClickOrHashChange, 300, true)); - $(document).on('click.form-fragment', 'a[href*="#"]', debounce(handleFragmentInteraction, 20)); + $(document).on('click.form-fragment', 'a[href*="#"]', debounce(handleFragmentLinkClickOrHashChange, 300, true)); })(jQuery, Drupal, Drupal.debounce); \ No newline at end of file