Improve homepage semantic HTML and accessibility for AI crawlers#369
Improve homepage semantic HTML and accessibility for AI crawlers#369JakeSCahill merged 2 commits intomainfrom
Conversation
- Add <main> landmark wrapper to homepage template - Fix mismatched heading tags (<h3> closing with </h2>) - Use <article> elements for feature cards instead of <div> - Add aria-labelledby attributes to sections - Add visually-hidden label for chat textarea (WCAG 1.3.1, 3.3.2, 4.1.2) - Add autocomplete attribute to chat input - Add .visually-hidden CSS class for accessibility - Support optional home-ai-summary and home-image-alt attributes - Wrap tertiary links in <nav> element Addresses AI audit findings for docs.redpanda.com homepage including semantic ratio, form accessibility, and content structure issues.
✅ Deploy Preview for docs-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request enhances accessibility and semantic structure across three files. A new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/css/home.css`:
- Around line 797-808: The .visually-hidden rule uses the deprecated property
clip; replace that property with the modern equivalent clip-path: inset(50%)
while keeping the rest of the declarations intact (position, width, height,
padding, margin, overflow, white-space, border) so the element remains visually
hidden but accessible; update the selector .visually-hidden in src/css/home.css
(the rule block shown) to remove clip(...) and add clip-path: inset(50%) to
satisfy Stylelint.
In `@src/partials/component-home-v2.hbs`:
- Around line 21-24: The section element currently hardcodes aria-labelledby
while the referenced heading is inside {{`#with`
page.attributes.home-primary-row-title}} (the h2 with id "home-primary-title"),
which can create a broken reference if the title is absent; update the template
so either the section's aria-labelledby is added only when
page.attributes.home-primary-row-title exists, or always render a fallback h2
(visually hidden or default text) with id "home-primary-title" when the
attribute is missing. Apply the same fix to the other two occurrences that use
the same pattern (the blocks around lines 45-48 and 69-72) so no section points
to a non-existent heading.
- Around line 15-16: The alt attribute uses unescaped triple-stash values
({{{page.attributes.home-image-alt}}} and {{{page.title}}}) which can break the
attribute or inject markup; update the <img> template in component-home-v2.hbs
to use normal Handlebars escaping ({{page.attributes.home-image-alt}} and
{{page.title}}) for the alt fallback so both home-image-alt and page.title are
HTML-escaped before insertion and cannot close the attribute or inject
attributes into the <img>.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: aae4b6ef-0029-49a3-86ef-06d33dfe2d49
📒 Files selected for processing (3)
src/css/home.csssrc/js/react/components/ChatInterface.jsxsrc/partials/component-home-v2.hbs
- Replace deprecated clip: rect() with clip-path: inset(50%) in .visually-hidden - Add fallback h2 headings for aria-labelledby references when titles are absent - Use double-stash escaping for alt attribute values to prevent injection
Fixes two layout issues introduced in PR #369: 1. Main element width constraint: Exclude .home-content from the nav-width calculation to prevent content from being squished on home pages - Updated main.css selector from `main:not(.labs)` to `main:not(.labs):not(.home-content)` 2. Overview heading layout: Move heading outside the .home-intro flex container and make it visually hidden to prevent inline display - Moved h2#home-overview before the .home-intro div - Added .visually-hidden class to hide heading while keeping it accessible Tested with Playwright to verify: - Main element has full width (1160px, not constrained) - Overview heading is visually hidden (height: 1px, not visible) - Intro paragraph displays on its own line Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Fix layout issues in component-home-v2 from PR #369 Fixes two layout issues introduced in PR #369: 1. Main element width constraint: Exclude .home-content from the nav-width calculation to prevent content from being squished on home pages - Updated main.css selector from `main:not(.labs)` to `main:not(.labs):not(.home-content)` 2. Overview heading layout: Move heading outside the .home-intro flex container and make it visually hidden to prevent inline display - Moved h2#home-overview before the .home-intro div - Added .visually-hidden class to hide heading while keeping it accessible Tested with Playwright to verify: - Main element has full width (1160px, not constrained) - Overview heading is visually hidden (height: 1px, not visible) - Intro paragraph displays on its own line Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Exclude metadata div for component-home-v2 pages The metadata--main div was being rendered even when empty for component-home-v2 pages, causing unwanted spacing below the h1. Wrapped the metadata div in an unless condition to exclude it completely for component-home-v2 role pages. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

Summary
<main>landmark wrapper to homepage template for better semantic structure<h3>closing with</h2>)<article>elements for feature cards instead of generic<div>aria-labelledbyattributes to all sectionsautocomplete="off"attribute to chat input.visually-hiddenCSS class for screen reader accessibilityhome-ai-summaryandhome-image-altpage attributes<nav>elementContext
Addresses AI audit findings for docs.redpanda.com homepage:
<div>elementsTest plan
gulp previewand verify homepage renders correctly at http://localhost:5252/home.html<main>,<section>,<article>,<nav>elementsgulp lintto ensure no linting errors