Opened 6 years ago
Last modified 5 months ago
#44656 new defect (bug)
Multiple themes: Empty site title leaves empty anchor tag in header
Reported by: | tsquez | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | needs-patch |
Focuses: | accessibility | Cc: |
Description
I just noticed something weird the other day with Twenty Twelve. I removed the title all together (no I did not hide it) and when I looked at the source code this is what I saw:
<h1 class="site-title"> <a href="http://localhost/dev/" rel="home"></a> </h1>
It's an H1 tag with an empty anchor? This shouldn't happen I don't think.
So I download a few other themes and did the same thing and sure enough all that was left was an empty H1 tag with an empty anchor tag.
I do not know why anyone would want to do this BUT If the site title is removed completely, meaning not hidden and not entered not entered either in "Settings" or "Site Identity" in the customizer, then the site H1 site title tag should not be displayed.
I am not sure if this is a bug so I thought I would enter it in. I looked all over and could not find any information or any other tickets regarding this.
I apologize if its a waste of time.
Thanks in advance.
Attachments (3)
Change History (14)
#2
@
6 years ago
- Keywords has-patch added
Hi and welcome to WordPress Trac, @tsquez !
Thanks for the ticket.
Even if it's a small edge case, I'd say we can easily solve it, so let's fix the issue :)
44656.diff
adds a condition to check if get_bloginfo( 'name' )
is empty or not.
Cheers,
Jb
#3
@
6 years ago
Oops, I didn't noticed you were talking about Twenty Twelve.
My patch is for Twenty Seventeen.
Of course, I can fix the issue on all bundled themes but I'm not sure we are still supporting old bundled themes for such a edge case… (cc @davidakennedy)
#4
@
6 years ago
- Keywords needs-patch added; has-patch removed
@laurelfulford Do you have any thoughts as to whether this is something that should be fixed? It seems reasonable to move to Future Release
, in my opinion.
#5
@
6 years ago
- Milestone changed from Awaiting Review to Future Release
@desrosj Agreed! :)
Thanks for the ping -- I've been moving through these tickets backwards, but it's slow going!
#7
@
5 years ago
- Summary changed from Empty site title leaves empty anchor tag in header to Twenty Twelve: Empty site title leaves empty anchor tag in header
- Version 4.9.7 deleted
#8
@
4 years ago
- Keywords has-patch added
44656.1.diff has the same conditional @audrasjb used for the site title, and it also checks the tagline/description.
#9
@
18 months ago
- Keywords needs-patch added; needs-testing has-patch removed
- Summary changed from Twenty Twelve: Empty site title leaves empty anchor tag in header to Multiple themes: Empty site title leaves empty anchor tag in header
I do not like allowing empty links or headings; however, (as noted above) most of the classic bundled themes have given superfluous markup when sites have not included a site title and/or tagline. If we fix it for Twenty Twelve, we probably should edit other themes, too.
Twenty Ten creates an empty link inside a heading if the site has no title. An empty tagline results in an empty div
(which usually is not a problem).
<h1 id="site-title"> <span> <a href="https://example.com/" rel="home"></a> </span> </h1> <div id="site-description"></div>
Twenty Eleven gives an empty link and/or heading.
<hgroup> <h1 id="site-title"><span><a href="https://example.com/" rel="home"></a></span></h1> <h2 id="site-description"></h2> </hgroup>
Twenty Twelve likewise gives an empty link and/or heading.
<hgroup> <h1 class="site-title"><a href="https://example.com/" rel="home"></a></h1> <h2 class="site-description"></h2> </hgroup>
Twenty Thirteen adds empty headings inside of a link.
<a class="home-link" href="https://example.com/" rel="home"> <h1 class="site-title"></h1> <h2 class="site-description"></h2> </a>
Twenty Fourteen, Twenty Fifteen, Twenty Sixteen and Twenty Seventeen all add a link inside a heading on the expectation that the site has a title. These four themes will, however, skip adding markup without a tagline.
<h1 class="site-title"><a href="https://example.com/" rel="home"></a></h1>
Twenty Twenty has slightly different markup, but it similarly leaves an empty link inside a heading when the site lacks a site title (and the theme does not include anything for an empty tagline).
<div class="header-titles"> <h1 class="site-title"><a href="https://example.com/"></a></h1> </div>
Twenty Nineteen and Twenty Twenty-One do not have any markup for either an empty site title or an empty tagline.
<div class="site-branding"> </div>
The block themes do not have any output for empty site titles either.
Adds site-title check before displaying it