From ca3d4fe5649d821740d33e86c79eaa9aa578752f Mon Sep 17 00:00:00 2001 From: Lauri Eskola <lauri.eskola@acquia.com> Date: Fri, 5 May 2023 11:04:49 +0300 Subject: [PATCH] Issue #3357112 by bnjmnm, hooroomoo, lauriii, smustgrave, ckrina: Reduce reflow on the Home / Back to Site button --- core/modules/toolbar/js/escapeAdmin.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/modules/toolbar/js/escapeAdmin.js b/core/modules/toolbar/js/escapeAdmin.js index 30af90bd36cf..2d76991e9dc5 100644 --- a/core/modules/toolbar/js/escapeAdmin.js +++ b/core/modules/toolbar/js/escapeAdmin.js @@ -20,7 +20,7 @@ } /** - * Replaces the "Home" link with "Back to site" link. + * Replaces "Back to site" link url when appropriate. * * Back to site link points to the last non-administrative page the user * visited within the same browser tab. @@ -33,12 +33,12 @@ Drupal.behaviors.escapeAdmin = { attach() { const toolbarEscape = once('escapeAdmin', '[data-toolbar-escape-admin]'); - if (toolbarEscape.length && pathInfo.currentPathIsAdmin) { - if (escapeAdminPath !== null) { - $(toolbarEscape).attr('href', escapeAdminPath); - } else { - toolbarEscape[0].textContent = Drupal.t('Home'); - } + if ( + toolbarEscape.length && + pathInfo.currentPathIsAdmin && + escapeAdminPath !== null + ) { + $(toolbarEscape).attr('href', escapeAdminPath); } }, }; -- GitLab