Skip to content

fix: add explicit h5 heading styles to maintain size hierarchy - #381

Merged
mmcky merged 3 commits into
mainfrom
fix/h5-heading-size
Apr 13, 2026
Merged

mmcky merged 3 commits into
mainfrom
fix/h5-heading-size

Conversation

@mmcky

@mmcky mmcky commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes an issue where h5 headings appeared visually larger than h4 headings, breaking the expected heading size hierarchy.

Example: This was observed on pages like JAX Introduction where h5 sub-headings (e.g. "14.1.2.1.1. With NumPy") appeared as large as or larger than the h4 heading above them (e.g. "14.1.2.1. Speed!").

Root Cause

h5 had no dedicated CSS rule in _base.scss. It only inherited from the general heading selector:

h1, h2, h3, h4, h5 {
  font-weight: normal;
  font-family: "PT Serif", serif;
  color: #444;
}

Meanwhile, h4 was explicitly styled with:

h4 {
  font-size: 1.2rem;
  font-family: "Source Sans Pro", sans-serif;
  font-weight: 900;
  color: #000;
}

Two factors combined to make h5 appear larger than h4:

  1. No explicit font-size — h5 fell back to the browser default size rather than a size smaller than h4's 1.2rem.
  2. Different font family — h5 inherited "PT Serif" (a serif font with larger visual glyph metrics) while h4 used "Source Sans Pro" (a more compact sans-serif), amplifying the perceived size difference.

Fix

Added an explicit h5 rule that maintains the descending heading hierarchy:

h5 {
  font-size: 1.0rem;
  font-family: "Source Sans Pro", sans-serif;
  font-weight: 900;
  color: #000;
}

Heading size hierarchy (after fix)

Heading Font Size Font Family
h1 2.0em PT Serif
h2 1.7rem PT Serif
h3 1.4rem PT Serif
h4 1.2rem Source Sans Pro
h5 1.0rem Source Sans Pro

Copilot AI review requested due to automatic review settings April 13, 2026 22:29
@mmcky

mmcky commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

@jstac fix is inbound for the h5 heading issue.

@codecov

codecov Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@371261e). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #381   +/-   ##
=======================================
  Coverage        ?   47.75%           
=======================================
  Files           ?        2           
  Lines           ?      423           
  Branches        ?        0           
=======================================
  Hits            ?      202           
  Misses          ?      221           
  Partials        ?        0           
Flag Coverage Δ
pytests 47.75% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes heading typography so h5 renders smaller than h4, restoring the expected visual hierarchy for nested sections.

Changes:

  • Add explicit h5 styling (font-size, font-family, font-weight, color) in base typography styles.

@github-actions

github-actions Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Visual Regression Test Results

passed  45 passed
skipped  1 skipped

Details

stats  46 tests across 1 suite
duration  1 minute, 3 seconds
commit  62d6d43

Skipped tests

mobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling

@github-actions

github-actions Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request April 13, 2026 22:37 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request April 13, 2026 23:12 Inactive
@mmcky
mmcky merged commit 36c6d9e into main Apr 13, 2026
9 checks passed
@mmcky
mmcky deleted the fix/h5-heading-size branch April 13, 2026 23:27

This branch was previously deployed

1 inactive deployment
pull request — 62d6d434 Deployed Apr 13, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants