Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Site Title Block] Encourage users to make proper semantic decisions #29644

Open
annezazu opened this issue Mar 8, 2021 · 9 comments
Open

[Site Title Block] Encourage users to make proper semantic decisions #29644

annezazu opened this issue Mar 8, 2021 · 9 comments
Labels
[Block] Site Title Affects the Site Title Block Needs Accessibility Feedback Need input from accessibility [Type] Enhancement A suggestion for improvement.

Comments

@annezazu
Copy link
Contributor

annezazu commented Mar 8, 2021

What problem does this address?

Currently, with FSE, you can alter aspects of your site you couldn't previously including the Site Title. As a result as part of FSE Outreach Program testing, the following feedback was raised:

Also, I wasn’t sure about being able to choose h2-h6 and p for the site title. I think it is fairly common practice to set h1 on the front page, and div/span on other pages. If a person who is using FSE is a developer, then perhaps we can leave it to the developer to make the decisions (and should be aware of semantics and web standard). But if one is non-developer, then may be it is more friendly to limit the choice, or just have h1 and may be allow to choose which tag for non-front-page.

What is your proposed solution?

Perhaps similar to how we show warnings for picking low contrast colors, we could show a nudge to encourage people to make good decisions around semantics for blocks like Site Title.

@annezazu annezazu added [Type] Enhancement A suggestion for improvement. [Block] Site Title Affects the Site Title Block labels Mar 8, 2021
@carolinan
Copy link
Contributor

Maybe the option could be moved the advanced section in the block settings sidebar, or vary depending on if it is inside a header template area or not.

@hedgefield
Copy link

I think in any situation it is ill-advised to make the title anything but an H1, right? Paging @afercia to confirm. If that's the case, let's remove that option completely, and leave the possibility of styling it to the text controls or advanced CSS?

@hedgefield hedgefield added the Needs Accessibility Feedback Need input from accessibility label Apr 29, 2021
@carolinan
Copy link
Contributor

carolinan commented Apr 29, 2021

It is the other way around, for example, on a single post, the most important heading is normally the post title.
Sometimes the site title is at the bottom of the site footer, where it is not a heading over any type of content, then it should not be a semantic heading.

If it is a landing page without any other type of main heading, and the site title is in the site header, then it should be an H1.

@cbirdsong
Copy link

cbirdsong commented Aug 26, 2021

A common pattern I've seen and implemented is wrapping the site title/logo in an <h1> tag, but only on the home page where it makes sense as the page title. In traditional Wordpress terms it would look something like this:

<? if (is_front_page()): ?><h1><? endif; ?>

<strong>
	<a href="<? echo esc_url( home_url() ); ?>" rel="home">
		
		<? echo wp_get_attachment_image(get_theme_mod( 'custom_logo' ), 'medium'); ?>
		<span <? if (has_custom_logo()) { ?>class="screen-reader-text"<? } ?>>
			<? bloginfo( 'name' ); ?>
		</span>
	</a>
</strong>

<? if (is_front_page()): ?></h1><? endif; ?>

Is there any affordance for this pattern in full-site editing?

@carolinan
Copy link
Contributor

The block is not context aware, it does not know if it is on the home page or where it is on the page.

I am not sure if there are ny good solutions to this, because I also don't think the element should change automatically without the site creator being aware.

@carolinan
Copy link
Contributor

As for making proper semantic decisions, the document outline will show if headings are in the incorrect order, but maybe it needs to be more visible.

@pagelab
Copy link
Contributor

pagelab commented Jul 29, 2022

If there is no way for the user to decide on the title level according to context (homepage vs inner pages), then the site title probably shouldn't be a <h1> by default.

A survey from 2017 showed that the majority (66%) of screen reader users prefer only one main heading containing the document title. There's also a Google News article that suggests the same as a best practice.

@carolinan
Copy link
Contributor

Yes there is a way, and that is by adding different headers to different pages. That method It is not free from its own problems.

@pagelab
Copy link
Contributor

pagelab commented Aug 1, 2022

Yes there is a way, and that is by adding different headers to different pages. That method It is not free from its own problems.

I mean, an automatic way to do this, as it is already possible with the Site Logo block by using add_theme_support( 'custom-logo', [ 'unlink-homepage-logo' => true ] )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Site Title Affects the Site Title Block Needs Accessibility Feedback Need input from accessibility [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants