Skip to content

Accessibility: Decouple heading HTML tag semantics from visual size classes in modular Dawn sections #3988

Open

Description

@andywestley

Summary / Problem Statement

In Shopify Dawn, modular sections commonly used as hero banners or content blocks (slideshow, rich-text, image-banner, image-with-text, multicolumn, etc.) conflate visual typography sizing with semantic HTML heading structure.

Currently, theme settings only expose heading_size (h2, h1, h0, hxl, hxxl), which merely toggles CSS classes (e.g. .h1). The underlying HTML markup remains hardcoded as <h2> in Liquid templates.

The Merchant Dilemma: Duplicate Titles vs. Missing H1

When merchants build custom landing pages (page.*.json) or custom collection pages (collection.*.json), they frequently replace the default main-page or main-collection-banner section with a richer hero layout (such as a slideshow, image-banner, or rich-text block) to introduce the page:

  1. If main-page / main-collection-banner is kept enabled: The page title is visually and semantically duplicated (e.g., once in the default banner and once in the hero section).
  2. If main-page / main-collection-banner is disabled: The page has no <h1> element at all, because all modular section headings hardcode <h2>.
  3. If a visually-hidden <h1> workaround is attempted: Screen reader users encounter duplicate heading announcements (e.g., Heading Level 1 "Summer Collection" immediately followed by Heading Level 2 "Summer Collection"), causing a degraded, confusing accessibility experience.

This leads to automated accessibility violations under WCAG 2.1 / 2.2 AA (1.3.1 Info and Relationships) and flags errors in auditing engines (e.g., Deque Axe-core page-has-heading-one and heading-order).


Describe the Expected Behavior

Merchants should be able to select the semantic HTML tag (<h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <p>, <div>) independently of the visual typography scale (heading_size).

  • Semantic control: Configured via a heading_tag select setting in the block/section schema.
  • Visual control: Continues to be controlled via the existing heading_size select setting.
  • Backwards compatibility: heading_tag defaults to h2 (or the section's existing default tag) across all stock sections so existing merchant templates remain 100% unaffected unless explicitly customized.

Technical Implementation / Proposed Solution

1. Schema Addition (Block or Section Settings)

Add a reusable heading_tag select setting to heading blocks and section headers:

{
  "type": "select",
  "id": "heading_tag",
  "options": [
    { "value": "h1", "label": "H1" },
    { "value": "h2", "label": "H2" },
    { "value": "h3", "label": "H3" },
    { "value": "h4", "label": "H4" },
    { "value": "h5", "label": "H5" },
    { "value": "h6", "label": "H6" },
    { "value": "p", "label": "Paragraph" },
    { "value": "div", "label": "Div" }
  ],
  "default": "h2",
  "label": "Heading tag"
}

2. Liquid Markup Dynamic Rendering

Replace hardcoded <h2> tags with dynamically assigned HTML tags:

sections/rich-text.liquid

- <h2 class="rich-text__heading rte inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
+ {%- assign heading_tag = block.settings.heading_tag | default: 'h2' -%}
+ <{{ heading_tag }} class="rich-text__heading rte inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
    {{ block.settings.heading }}
- </h2>
+ </{{ heading_tag }}>

sections/slideshow.liquid

- <h2 class="banner__heading inline-richtext {{ block.settings.heading_size }}">
+ {%- assign heading_tag = block.settings.heading_tag | default: 'h2' -%}
+ <{{ heading_tag }} class="banner__heading inline-richtext {{ block.settings.heading_size }}">
    {{ block.settings.heading }}
- </h2>
+ </{{ heading_tag }}>

sections/image-banner.liquid

- <h2 class="banner__heading inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
+ {%- assign heading_tag = block.settings.heading_tag | default: 'h2' -%}
+ <{{ heading_tag }} class="banner__heading inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
    {{ block.settings.heading }}
- </h2>
+ </{{ heading_tag }}>

sections/image-with-text.liquid

- <h2 class="image-with-text__heading inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
+ {%- assign heading_tag = block.settings.heading_tag | default: 'h2' -%}
+ <{{ heading_tag }} class="image-with-text__heading inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
    {{ block.settings.heading }}
- </h2>
+ </{{ heading_tag }}>

sections/multicolumn.liquid

- <h2 class="title inline-richtext {{ section.settings.heading_size }}">
+ {%- assign heading_tag = section.settings.heading_tag | default: 'h2' -%}
+ <{{ heading_tag }} class="title inline-richtext {{ section.settings.heading_size }}">
    {{ section.settings.title }}
- </h2>
+ </{{ heading_tag }}>

Affected Sections in Dawn

  1. sections/slideshow.liquid (slide block)
  2. sections/rich-text.liquid (heading block)
  3. sections/image-banner.liquid (heading block)
  4. sections/image-with-text.liquid (heading block)
  5. sections/multicolumn.liquid (section header)
  6. sections/featured-collection.liquid (section header)
  7. sections/featured-blog.liquid (section header)
  8. sections/collage.liquid (section header)
  9. sections/collection-list.liquid (section header)

Standards, WCAG Compliance & References

  • WCAG 2.1 / 2.2 Success Criterion 1.3.1 Info and Relationships (Level A): Requires programmatic heading structure to represent visual hierarchy and page context accurately.
  • Deque Axe-core Rules:
    • page-has-heading-one: Ensures every page has exactly one top-level heading introducing the main content.
    • heading-order: Ensures heading levels are logically ordered without skipping levels.
  • Shopify Theme Store Requirement: Themes submitted to the Shopify Theme Store must satisfy WCAG 2.1 AA requirements.

Activity

  1. changed the title [-]Decouple heading HTML tag semantics from visual size classes in modular Dawn sections[/-] [+]Accessibility: Decouple heading HTML tag semantics from visual size classes in modular Dawn sections[/+] on Sep 23, 2026
  2. github-actions commented on Nov 22, 2026

    @github-actions

    This issue has been marked as stale due to inactivity for 60 days. Please comment or update if this is still relevant, otherwise it will be closed in 7 days.

  3. andywestley commented on Nov 22, 2026

    @andywestley
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions