Repository navigation
Decouple heading HTML tag semantics from visual size classes in modular sections - #3989
Closed
officialSmartWoo wants to merge 1 commit into
Closed
officialSmartWoo wants to merge 1 commit into
officialSmartWoo wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary:
Introduced a
heading_tagsetting to decouple semantic HTML heading levels (h1-h6,p,div) from visual typography classes (heading_size) in modular sections, ensuring merchants can create accessible heading hierarchies across custom landing pages and heroes.Why are these changes introduced?
Fixes #3988.
In Shopify Dawn, modular sections frequently used as hero banners or content blocks (
slideshow,rich-text,image-banner,image-with-text,multicolumn,featured-collection,featured-blog,collage,collection-list) hardcoded<h2>in Liquid templates regardless of the selectedheading_size. When merchants build custom landing pages or replace default banners with hero sections, pages frequently ended up without an<h1>tag or with duplicate headings, violating WCAG 2.1/2.2 AA (SC 1.3.1 Info and Relationships) and failing automated Axe-core audits (page-has-heading-one,heading-order).What approach did you take?
sections.all.heading_tagwith options forh1-h6,p("Paragraph"), anddiv("Div") inlocales/en.default.schema.json.heading_tagselect setting with default value"h2"to all 9 affected modular sections (rich-text,slideshow,image-banner,image-with-text,multicolumn,featured-collection,featured-blog,collage,collection-list).<h2>tags with dynamic<{{ heading_tag }} ...></{{ heading_tag }}>whereheading_tag = ...settings.heading_tag | default: 'h2'.Other considerations
"h2"and using| default: 'h2'in Liquid, existing merchant pages and saved sections withoutheading_tagconfigured will continue to render<h2>tags without any visual or DOM structure changes.heading_size(e.g..h0,.h1,.h2), maintaining design fidelity while giving full control over semantic document structure.Decision log
heading_tagselect setting with defaulth2panddivalongsideh1-h6h1-h6Visual impact on existing themes
None. Existing merchant templates and defaults render
<h2>exactly as before. When a different heading tag is selected, only the semantic HTML element tag changes; visual size and font styles continue to followheading_size.Testing steps/scenarios
shopify theme checkto verify schema validation and locale key consistency across all files (0 errors).heading_tagdefaults to<h2>...</h2>.heading_tagtoh1,h3,p, anddivand verify correct opening/closing HTML tags in rendered output.Demo links
Checklist