From 905efbc90a34db06e7aa5eb3c6cbd0bea7821dbb Mon Sep 17 00:00:00 2001 From: Lauri Eskola Date: Tue, 14 Feb 2023 17:54:09 +0200 Subject: [PATCH] Issue #2951268 by dww, ndf, Chi, bnjmnm, lauriii, drintios, kishor_kolekar, tim.plunkett, quietone: Improve rendering account link in the toolbar --- core/lib/Drupal/Core/Render/Renderer.php | 1 + core/modules/user/user.module | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index 019a2c133fd..6d08e4d81c9 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -327,6 +327,7 @@ class Renderer implements RendererInterface { '#cache', '#create_placeholder', '#lazy_builder_preview', + '#preview', // The keys below are not actually supported, but these are added // automatically by the Renderer. Adding them as though they are // supported allows us to avoid throwing an exception 100% of the time. diff --git a/core/modules/user/user.module b/core/modules/user/user.module index a4301211770..84d9fb7851f 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1181,6 +1181,12 @@ function user_toolbar() { $items['user']['tab']['#title'] = [ '#lazy_builder' => ['user.toolbar_link_builder:renderDisplayName', []], '#create_placeholder' => TRUE, + '#lazy_builder_preview' => [ + // Add a line of whitespace to the placeholder to ensure the icon is + // positioned in the same place it will be when the lazy loaded content + // appears. + '#markup' => ' ', + ], ]; $items['user']['tray']['user_links'] = [ '#lazy_builder' => ['user.toolbar_link_builder:renderToolbarLinks', []],