Skip to content

Use semantic HTML for landmarks, navigation, and headings#16

Open
simonmorley wants to merge 1 commit intomainfrom
semantic-html-sweep
Open

Use semantic HTML for landmarks, navigation, and headings#16
simonmorley wants to merge 1 commit intomainfrom
semantic-html-sweep

Conversation

@simonmorley
Copy link
Copy Markdown
Member

Summary

  • Layout.tsx: <header>, <main>, <footer> for ARIA landmark regions — screen readers can now navigate between page sections
  • TabBar.tsx: <nav> for primary tab navigation (desktop + mobile)
  • LeaderboardPage / ReportsPage: Section headings use <h2> + <p> instead of <div>
  • ValidatorProfile.tsx: Section headings (Reliability, event history, infrastructure) use <h2> via shared sectionHeadingStyle

All changes are zero visual impact — fontWeight: 400 added to <h2> elements to prevent browser bold default.

Test plan

  • Visually confirm no rendering differences on any page
  • Check heading hierarchy in browser dev tools (h1 → slashr, h2 → page sections)
  • Verify ARIA landmarks visible in accessibility tree (header, main, footer, nav)
  • Mobile nav dropdown still opens/closes correctly

Replace generic divs with proper semantic elements site-wide:
- Layout: header, main, footer for ARIA landmark regions
- TabBar: nav for primary navigation
- Page headings: h2 instead of div (with fontWeight: 400)
- ValidatorProfile: h2 for section headings
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves the semantic structure and accessibility of the application by replacing generic div elements with appropriate HTML5 tags such as header, main, footer, nav, h2, and p. Key changes include updating the layout components, navigation bars, and section headings across several pages. Feedback focuses on refining the heading hierarchy in the ValidatorProfile component, suggesting the use of h3 tags for sub-sections like 'Reliability', 'event history', and 'infrastructure' to ensure a correct document outline relative to the main validator heading.

return (
<div style={{ marginBottom: 24, paddingBottom: 24, borderBottom: '1px solid var(--color-border)' }}>
<div style={sectionHeadingStyle}>Reliability</div>
<h2 style={sectionHeadingStyle}>Reliability</h2>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since the validator name is defined as an <h2> (on line 467), sub-sections like "Reliability" should use <h3> to maintain a proper heading hierarchy. This helps screen reader users understand the document structure more effectively.

Suggested change
<h2 style={sectionHeadingStyle}>Reliability</h2>
<h3 style={sectionHeadingStyle}>Reliability</h3>

Comment on lines +677 to +679
<h2 style={sectionHeadingStyle}>
event history
</div>
</h2>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To maintain a consistent and correct heading hierarchy, this sub-section should use an <h3> tag, as it is logically nested under the validator's name (<h2>).

Suggested change
<h2 style={sectionHeadingStyle}>
event history
</div>
</h2>
<h3 style={sectionHeadingStyle}>
event history
</h3>

Comment on lines +869 to +871
<h2 style={sectionHeadingStyle}>
infrastructure
</div>
</h2>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This section should be an <h3> to correctly reflect its position in the document outline relative to the main validator heading.

Suggested change
<h2 style={sectionHeadingStyle}>
infrastructure
</div>
</h2>
<h3 style={sectionHeadingStyle}>
infrastructure
</h3>

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.

1 participant