Skip to content

Infra: change <article> to <main>#4996

Merged
encukou merged 1 commit into
python:mainfrom
hugovk:article-main
Jun 11, 2026
Merged

Infra: change <article> to <main>#4996
encukou merged 1 commit into
python:mainfrom
hugovk:article-main

Conversation

@hugovk

@hugovk hugovk commented Jun 11, 2026

Copy link
Copy Markdown
Member

Follow on from #4977.

We still get "697 files changed · ± 697 modified" on the Read the Docs previews: #4994 (comment).

The detection logic is:

  1. Elements with role="main" attribute: This ARIA role is used by many static site generators and themes to indicate the main content area.
  2. The <main> HTML tag: The semantic HTML5 element for main content.
  3. Parent of the first <h1> tag: If no explicit main content markers are found, the system assumes all sections are siblings under a common parent, and uses the parent of the first heading as the main content container.
  4. The <body> tag: As a last resort, if none of the above are found, the entire body is used.

Let's go for 2 and use <main> instead of <article role="main">:

Both have good semantics: there can be multiple articles in a page (we have just one), or a single main. But main is also a "landmark", which helps accessibility:

The <main> element behaves like a main landmark role. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. Prefer using the <main> element over declaring role="main", unless there are legacy browser support concerns.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/main

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/article

@hugovk hugovk requested a review from AA-Turner as a code owner June 11, 2026 08:22
@hugovk hugovk added the infra Core infrastructure for building and rendering PEPs label Jun 11, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pep-previews | 🛠️ Build #33089638 | 📁 Comparing 328696a against latest (0cc5e08)

  🔍 Preview build  

749 files changed · ± 749 modified

± Modified

@encukou encukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thank you!

@encukou encukou merged commit c8954b4 into python:main Jun 11, 2026
25 checks passed
@hugovk hugovk deleted the article-main branch June 11, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra Core infrastructure for building and rendering PEPs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants