Skip to content

Conversation

JakeSCahill
Copy link
Contributor

@JakeSCahill JakeSCahill commented Aug 27, 2025

I recently checked our CLS score in Google Search Console and while all of our pages on mobile are good, on desktop they are all poor.

Using Chrome dev tools, I narrowed down the culrpit to the <main> element.

2025-08-27_12-28-15 (1)

After these changes, the CLS is significantly reduced.

This pull request introduces several improvements to the site's layout and performance, with a focus on search UI stability, layout consistency, and font loading optimization. The most significant changes are grouped below:

Layout and UI Consistency:

  • Added a min-height to the footer.footer and updated main.article to ensure the main content area always fills the viewport, improving page structure and preventing layout issues when content is short. [1] [2]
  • Updated the Redpanda logo in the header to use explicit width, height, and aspect ratio, ensuring consistent display across browsers.

Search UI Stability:

  • Set minimum and maximum dimensions for the Algolia preview panel in both search.css and search-bump.css to reserve space and prevent Cumulative Layout Shift (CLS), resulting in a more stable search experience. [1] [2]

Performance Optimization:

  • Preloaded key font files in head.hbs to improve font loading performance and reduce layout shifts caused by late font rendering.

- Set min-height on main.article to prevent layout shift as content loads
- Set footer min-height to match reserved space in layout
- Minor: update logo width in header
Copy link
Contributor

coderabbitai bot commented Aug 27, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbit review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This PR adjusts layout and rendering across CSS and Handlebars templates. It adds min-height to the footer and converts main.article into a vertical flex container with a viewport-based min-height, plus responsive tweaks for TOC visibility and content overflow. It updates Algolia search preview styles to reserve fixed space, replacing a prior margin-only rule (in both search.css and search-bump.css). Head markup now preloads five WOFF2 fonts with crossorigin. The header logo image gets fixed width/height and an aspect-ratio style. No control flow or templating logic changes are introduced.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • kbatuigas
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cls

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit ae5879c
🔍 Latest deploy log https://app.netlify.com/projects/docs-ui/deploys/68b00a0a5045e100081c2188
😎 Deploy Preview https://deploy-preview-332--docs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 25 (🔴 down 12 from production)
Accessibility: 93 (no change from production)
Best Practices: 100 (no change from production)
SEO: 88 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@JakeSCahill JakeSCahill requested a review from paulohtb6 August 27, 2025 11:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (8)
src/css/footer.css (1)

11-11: Replace magic number with a shared variable to avoid drift with main.article calc.

Use a CSS custom property so footer height stays in sync across files.

Apply this diff:

-  min-height: 60px;
+  min-height: var(--footer-min-height);

Add once in a global variables scope (e.g., :root or your variables file):

:root { --footer-min-height: 60px; }
src/css/search-bump.css (1)

192-199: Parametrize Algolia preview sizing; reduce duplication risk with search.css.

Same block exists in search.css. Use CSS vars with sensible fallbacks so both bundles stay consistent.

Apply this diff:

-/* Reserve space for Algolia preview panel to prevent CLS */
-.aa-Preview.aa-Column.doc {
-  min-width: 350px;
-  max-width: 600px;
-  min-height: 400px;
-  margin-top: 0;
-}
+/* Reserve space for Algolia preview panel to prevent CLS */
+.aa-Preview.aa-Column.doc {
+  min-width: var(--aa-preview-min-width, 350px);
+  max-width: var(--aa-preview-max-width, 600px);
+  min-height: var(--aa-preview-min-height, 400px);
+  margin-top: 0;
+}

Please confirm whether both search.css and search-bump.css are loaded together. If yes, consider keeping this rule in a single bundle or introduce the vars above in one place to avoid future drift.

src/partials/header-content.hbs (1)

7-7: Good CLS fix with explicit dimensions; consider async decoding hint.

Width/height + aspect-ratio is solid. Add decoding=async to avoid blocking paint.

Apply this diff:

-      <a class="navbar-item" href="{{{relativize this}}}" aria-label="Go to home page"><img src="{{{@root.uiRootPath}}}/img/redpanda-docs-logo-white.svg" width="150" height="22" style="aspect-ratio:150/22;" alt="Redpanda logo"/></a>
+      <a class="navbar-item" href="{{{relativize this}}}" aria-label="Go to home page"><img src="{{{@root.uiRootPath}}}/img/redpanda-docs-logo-white.svg" width="150" height="22" style="aspect-ratio:150/22;" decoding="async" alt="Redpanda logo"/></a>
src/css/main.css (2)

2-2: Use the same footer variable here to keep layout math single-sourced.

Align with footer.css to prevent subtle CLS from mismatched values.

Apply this diff:

-  min-height: calc(100vh - var(--body-top) - 60px);
+  min-height: calc(100vh - var(--body-top) - var(--footer-min-height));

12-15: Prevent flex child overflow on mobile Safari.

When main.article is a flex container, some children can overflow. Add min-height: 0 to the content area.

Add (outside this hunk):

main > .content { min-height: 0; }

Check short-content pages at ~768–1024px to ensure no extra vertical scrollbar appears due to the new calc/min-heights.

src/css/search.css (1)

245-252: DRY up Algolia preview sizing and sync with search-bump.css.

Mirror the variable-based rule so both bundles stay aligned.

Apply this diff:

-/* Reserve space for Algolia preview panel to prevent CLS */
-.aa-Preview.aa-Column.doc {
-  min-width: 350px;
-  max-width: 600px;
-  min-height: 400px;
-  margin-top: 0;
-}
+/* Reserve space for Algolia preview panel to prevent CLS */
+.aa-Preview.aa-Column.doc {
+  min-width: var(--aa-preview-min-width, 350px);
+  max-width: var(--aa-preview-max-width, 600px);
+  min-height: var(--aa-preview-min-height, 400px);
+  margin-top: 0;
+}

On ~900–1100px widths, confirm the grid (45% 1fr) doesn’t force the preview below its min-width, causing horizontal scroll.

src/partials/head.hbs (2)

6-10: Move preloads earlier in to maximize impact.

Place these links before {{> head-styles}} so the browser can fetch fonts in parallel with CSS, not after it.

Apply:

 {{> head-info}}
-{{> head-styles}}
-<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-Regular.woff2" as="font" type="font/woff2" crossorigin>
-<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-medium.woff2" as="font" type="font/woff2" crossorigin>
-<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-bold.woff2" as="font" type="font/woff2" crossorigin>
-<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-semibold.woff2" as="font" type="font/woff2" crossorigin>
-<link rel="preload" href="{{{@root.uiRootPath}}}/font/Patron-Medium.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-Regular.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-medium.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-bold.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="{{{@root.uiRootPath}}}/font/calibre-semibold.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="{{{@root.uiRootPath}}}/font/Patron-Medium.woff2" as="font" type="font/woff2" crossorigin>
+{{> head-styles}}

6-10: Scope preloads to critical, above-the-fold fonts; add preconnect if cross-origin.

If all five aren’t needed at first paint, preload only the body + headings weights to reduce contention; rely on font-display for the rest. If fonts are served from a different origin, add a preconnect with crossorigin to that origin in head.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 22a2f16 and b9796ca.

📒 Files selected for processing (6)
  • src/css/footer.css (1 hunks)
  • src/css/main.css (1 hunks)
  • src/css/search-bump.css (1 hunks)
  • src/css/search.css (1 hunks)
  • src/partials/head.hbs (1 hunks)
  • src/partials/header-content.hbs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
src/partials/head.hbs (1)

6-10: LGTM: correct preload attributes for fonts.

Using rel="preload" with as="font", type="font/woff2", and crossorigin is correct and should help reduce CLS from late font swaps.

@JakeSCahill JakeSCahill requested a review from a team August 27, 2025 16:34
@JakeSCahill JakeSCahill merged commit 63bf1ab into main Aug 28, 2025
6 checks passed
@JakeSCahill JakeSCahill deleted the cls branch August 28, 2025 15: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