0

For "fixed" dialogs displayed over the page, like a "cookie consent banner" or "subscribe to notifications", what is the recommended tag for the title (e.g. "Your privacy matters", "Subscribe to our newsletter", etc.)?

Is it correct to use h1 to separate it from the main content?

Or another tag (h2, h5, p, span, b, etc.) is more appropriate for the title of such banners?

I am concerned with SEO and accessibility.

2 Answers 2

1

Headings are landmarks for users of assistive tools, good for navigating quickly through the document. Heading landmarks are most used1 and screen reader users prefer h1 to be the document title2. Any section on the page that functions as a landmark3 should be structurally (not per se visually) directly under document header and therefore start with a h2.

So to directly answer your question, use h2 as section header for cookie consent modals/banners, subscribe to notifications/newsletter etc. as long as they are separate sections on the page that are not within other sections.

1 https://webaim.org/projects/screenreadersurvey7/#finding
2 https://webaim.org/projects/screenreadersurvey7/#heading
3 https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/roles/landmark_role

1
0

Although SEO techniques like keyword stuffing and creating several H1 headers have become industry standards, they may not always make your website accessible to people with all backgrounds, levels of education, and devices.

The following conditions need to be met in order for headers to be accessible:

  1. There can only be one H1 heading.
  2. There must be a linear framework for headers. Following H1s, H2s will serve as sub-headers for the H1. Following H2s, H3s will serve as sub- headers for the H2. And so on.
  3. Headers must clearly define the sections of content. Like Title Tags, their language should accurately reflect the content that follows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.