I'm working on a custom Drupal 8.7.8 theme, and have run into an odd issue: the user name in the "My Account" item is missing. The user icon is present, just no text, and it is misaligned.  The source code is as follows:

<a 
	href="/drupal/user"
	title="My account"
	class="toolbar-icon toolbar-icon-user trigger toolbar-item ally-focus-within"
	id="toolbar-item-user"
	>
		<span></span>
</a>

I have removed some ARIA information and some data attributes for legibility.

The culprit is that empty SPAN.  If I type in some text there using my browser's developer tools, the icon snaps into the correct alignment and displays correctly.

So my question is: why is the text not rendering?  We don't have any preprocess functions that might have messed with it.  What should I be looking for?

Comments

dibyajyoti.mallick’s picture

Hi,

May be issue in span css, you can check with span css class and put some height width or padding if not mention there.

Go to theme template header region twig file and update the code.

For properly checking need all source code for that.

Thanks

wdmartin’s picture

I don't think it's a CSS issue -- there is data missing from the HTML.  The span is supposed to have a user name in it, and it doesn't.  Here's a pastebin link of the full generated HTML source code -- the span in question is on line 101.

As far as I can tell, the HTML in question is generated by toolbar.html.twig. It's using the copy of that template from core; we haven't modified it. So I don't know why it's not printing out the user name.