Skip to content

fix(typography): restore the heading hierarchy in articles - #316

Merged
yasinmiran merged 1 commit into
mainfrom
fix/article-heading-scale
Aug 10, 2026
Merged

fix(typography): restore the heading hierarchy in articles#316
yasinmiran merged 1 commit into
mainfrom
fix/article-heading-scale

Conversation

@yasinmiran

Copy link
Copy Markdown
Collaborator

The article title and the headings inside the body were sized in two different places that had never been reconciled: the title in page.astro, the content headings in elements.tsx.

Before

width title h2 body
375 24 30 18
768 36 30 18
1440 36 30 18

On desktop the title was only 1.2x the h2 under it. Below 640px it was worse: the h2 was bigger than the article title, so the section heading outranked the page heading on every phone.

After

width title h2 h3 h4 body
375 30 20 18 18 18
768 48 30 24 20 18
1440 48 30 24 20 18

Title/h2 holds between 1.5 and 1.6 from 320px up. No horizontal overflow at any width tested (320, 375, 640, 768, 1024, 1440).

The content headings had to become responsive for this to hold; fixed sizes were the reason the scale inverted on small screens.

Also: h5 and h6 were 18px and 16px against 18px body, so a heading was the same size as or smaller than the text it introduced. Both now sit at body size and separate by weight.

Only the shared page title and the MDX heading components change, so this applies to every content page (news, events, services, funding), not just news.

pnpm build passes, 0 errors.

The article title and the headings inside the body were sized independently and
had drifted into each other. The title was text-2xl/3xl/4xl while every content
heading was a fixed size, so on desktop the title was 36px against a 30px h2,
and below 640px the h2 was the larger of the two: the section heading outranked
the page heading on every phone.

The title now runs text-3xl/4xl/5xl and the content headings step down with it
at the same breakpoints, holding a 1.5 to 1.6 ratio from 320px up. Desktop
reads 48/30/24/20 against 18px body.

h5 and h6 sat at and below the body size, which made them read as captions
rather than headings. Both now sit on the body size and separate by weight.
Copilot AI lite review requested due to automatic review settings August 10, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts typography so article/page titles consistently outrank in-body headings across breakpoints, eliminating cases where section headings visually dominate the page title on small screens.

Changes:

  • Increase shared page <h1> title sizing in page.astro (text-3xl/4xl/5xl).
  • Make MDX heading components responsive (H1–H4) and adjust H5/H6 sizing/weight to maintain separation from body text.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/layouts/page.astro Bumps the shared page title scale to restore visual hierarchy vs. body headings.
src/components/elements.tsx Updates MDX heading component typography to be responsive and preserve heading hierarchy on small screens.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 32 to 34
export const H1: React.FC<React.HTMLAttributes<HTMLHeadingElement>> = ({ className, ...props }) => (
<h1 {...props} className={className || "text-4xl font-bold mt-8 mb-4 scroll-mt-12"}/>
<h1 {...props} className={className || "text-2xl sm:text-3xl md:text-4xl font-bold mt-8 mb-4 scroll-mt-12"}/>
);
Comment on lines 40 to 42
export const H3: React.FC<React.HTMLAttributes<HTMLHeadingElement>> = (props) => (
<h3 {...props} className="text-2xl font-semibold mt-5 mb-2 scroll-mt-12"/>
<h3 {...props} className="text-lg sm:text-xl md:text-2xl font-semibold mt-5 mb-2 scroll-mt-12"/>
);
@yasinmiran
yasinmiran merged commit c24dd92 into main Aug 10, 2026
2 checks passed
@yasinmiran
yasinmiran deleted the fix/article-heading-scale branch August 10, 2026 10:21
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