Skip to content

Add cookie preferences link to footer site-wide#377

Merged
JakeSCahill merged 1 commit into
mainfrom
DOC-2102
Apr 29, 2026
Merged

Add cookie preferences link to footer site-wide#377
JakeSCahill merged 1 commit into
mainfrom
DOC-2102

Conversation

@JakeSCahill
Copy link
Copy Markdown
Contributor

Summary

  • Adds footer with cookie preferences link to all documentation pages
  • Aligns documentation site with other Redpanda web properties
  • Enables users to manage cookie consent settings and CCPA opt-out

Changes

  • Added data-onetrust="true" attribute to cookie preferences link in footer
  • Added footer partial to all page layouts (index, default, 404, lab)
  • Cookie preferences link positioned between privacy policy and copyright

Test plan

  • Build UI bundle and verify no build errors
  • Test footer appears on home page
  • Test footer appears on article pages
  • Test footer appears on 404 page
  • Test footer appears on lab pages
  • Verify cookie preferences link triggers OneTrust modal

Fixes DOC-2102

🤖 Generated with Claude Code

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 29, 2026

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit aba16b1
🔍 Latest deploy log https://app.netlify.com/projects/docs-ui/deploys/69f226a9046d3300082013e4
😎 Deploy Preview https://deploy-preview-377--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: 36 (🔴 down 1 from production)
Accessibility: 93 (no change from production)
Best Practices: 92 (no change from production)
SEO: 89 (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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

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 @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d05c00e7-5ca7-4abc-922c-0bc316d431a9

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds footer rendering to multiple page layouts and introduces a cookie preferences link in the footer partial. The footer partial is included in four layout files (404, default, index, and lab) immediately after the body partial. Additionally, a new "Cookie preferences" anchor link with the OneTrust data attribute is added to the footer content partial to enable cookie consent widget integration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a cookie preferences link to the footer across all pages in the documentation site.
Description check ✅ Passed The description is well-related to the changeset, providing clear context about why the change is being made, what was changed, and how to test it.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DOC-2102

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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

🤖 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/partials/footer-content.hbs`:
- Line 74: The anchor with class "text-style-footer-legal" currently uses
href="#" and data-onetrust="true" but has no handler; add a click handler in
your frontend JS that targets the anchor (e.g., select by class
"text-style-footer-legal") to call OneTrust.showPreferencesUI('self') and
preventDefault/stopPropagation to avoid page jumps, and update the markup to a
safe fallback (replace href="#" with href="javascript:void(0)" or add
role="button" and tabindex="0") until the JS is loaded; ensure the handler
checks for OneTrust existence before calling to avoid runtime errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8231373f-f767-4b05-bb0a-0d1abcb11768

📥 Commits

Reviewing files that changed from the base of the PR and between 6941e66 and 5028fec.

📒 Files selected for processing (5)
  • src/layouts/404.hbs
  • src/layouts/default.hbs
  • src/layouts/index.hbs
  • src/layouts/lab.hbs
  • src/partials/footer-content.hbs

</div>
<div class="footer__legal-container">
<a href="https://redpanda.com/legal/privacy-policy" target="_blank" rel="noopener noreferrer" class="text-style-footer-legal">Privacy policy</a>
<a data-onetrust="true" href="#" class="text-style-footer-legal">Cookie preferences</a>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 29, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does OneTrust support triggering the preference center from a element usingdata-onetrust="true", or does it require an with a specific selector/class?

💡 Result:

No, OneTrust does not support triggering the preference center directly from a

element using data-onetrust="true". Official documentation consistently shows that the preference center is triggered programmatically using JavaScript methods like OneTrust.showPreferencesUI('self') after SDK initialization. There is no mention of data-onetrust attributes or automatic handling for custom buttons/links with specific selectors/classes in the developer docs. Custom links require manual JavaScript event listeners to call the show method. OneTrust provides a built-in persistent "Cookie Settings" floating button (#ot-sdk-btn-floating), but for custom elements, JS is needed. Neither nor with data-onetrust="true" works out-of-the-box; it requires explicit JS integration.

Citations:


🏁 Script executed:

# Search for OneTrust-related code and data-onetrust usage
rg -i "data-onetrust|onetrust" --type html --type js --type ts -B 2 -A 2

Repository: redpanda-data/docs-ui

Length of output: 47


🏁 Script executed:

# Also search for any JavaScript files that might handle preference center triggers
rg "showPreferencesUI|cookie.?preference|preference.?center" --type js --type ts -B 2 -A 2

Repository: redpanda-data/docs-ui

Length of output: 47


🏁 Script executed:

# Check if there's any OneTrust SDK initialization or configuration
rg -i "onetrust|ot-sdk" --type js --type ts --type html

Repository: redpanda-data/docs-ui

Length of output: 47


🏁 Script executed:

# Search ALL files for data-onetrust usage (not just code files)
rg "data-onetrust" -B 2 -A 2

Repository: redpanda-data/docs-ui

Length of output: 644


🏁 Script executed:

# Check package.json for OneTrust related dependencies
cat package.json | grep -i "onetrust\|cookie" || echo "No OneTrust/cookie mentions in package.json"

Repository: redpanda-data/docs-ui

Length of output: 109


🏁 Script executed:

# Look at the actual footer-content.hbs file to understand context
cat -n src/partials/footer-content.hbs | head -100

Repository: redpanda-data/docs-ui

Length of output: 11483


Add JavaScript to handle cookie preference trigger; href="#" and data-onetrust attribute are non-functional.

Line 74 uses data-onetrust="true", but OneTrust SDK does not natively support this attribute on HTML elements. Triggering the preference center requires explicit JavaScript integration (e.g., OneTrust.showPreferencesUI('self')). Additionally, the href="#" fallback will cause unwanted page jumps if the handler is not in place.

Add a click event listener to properly integrate with OneTrust, or use href="javascript:void(0)" with onclick="return false" as a temporary safeguard while awaiting JS implementation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/partials/footer-content.hbs` at line 74, The anchor with class
"text-style-footer-legal" currently uses href="#" and data-onetrust="true" but
has no handler; add a click handler in your frontend JS that targets the anchor
(e.g., select by class "text-style-footer-legal") to call
OneTrust.showPreferencesUI('self') and preventDefault/stopPropagation to avoid
page jumps, and update the markup to a safe fallback (replace href="#" with
href="javascript:void(0)" or add role="button" and tabindex="0") until the JS is
loaded; ensure the handler checks for OneTrust existence before calling to avoid
runtime errors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is how it said to do it in the Jira.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@JakeSCahill, understood — if the Jira specifies data-onetrust="true" as the integration hook, then Redpanda's OneTrust setup likely has a custom JavaScript layer that targets elements with this attribute and wires up the preference center trigger. That's a perfectly valid implementation pattern.

One minor thing worth keeping in mind: if the OneTrust script hasn't loaded yet (e.g., due to a slow network), clicking the link will still navigate to # and cause a page jump. If that's a concern, you could use href="javascript:void(0)" as a safer no-op fallback — but that's a low-priority detail and entirely up to you.

I'll defer to your Jira spec on this. Happy to close this comment if it's resolved from your side.


✏️ Learnings added
Learnt from: JakeSCahill
Repo: redpanda-data/docs-ui PR: 377
File: src/partials/footer-content.hbs:74-74
Timestamp: 2026-04-29T15:43:48.188Z
Learning: In the redpanda-data/docs-ui repository, the `data-onetrust="true"` attribute on anchor elements in `src/partials/footer-content.hbs` is the intentional, Jira-specified integration hook for Redpanda's OneTrust cookie preference center. Their OneTrust setup uses a custom JavaScript layer that targets elements with `data-onetrust="true"` to wire up the preference center trigger. Do not flag this attribute as non-functional or unsupported.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From Claude:

Here's the clear picture:

What's in the code: The PR (already merged) added this exact line:
Cookie preferences

Why it likely isn't working: There is no click handler anywhere in the repo for data-onetrust or for this class. The link renders in the HTML but clicking it
either does nothing or jumps the page (due to href="#"). The "does not appear" likely means the link is visible but the OneTrust preferences panel never opens.


Would the CodeRabbit fix work? Partially — but it has a critical bug:

The suggestion says to select by class "text-style-footer-legal" to call OneTrust.showPreferencesUI('self'). That class is shared with the Privacy Policy link
and the copyright div, so that handler would fire on all three elements.

The correct selector to use is [data-onetrust="true"], not the class.


The better fix — two options:

Option A (simpler, uses OneTrust's built-in wiring): Change the anchor to use OneTrust's standard class instead of the custom data-onetrust attribute — OneTrust
SDK auto-wires click handlers to this:
Cookie preferences

Option B (explicit JS handler): Add to a JS file in src/js/:
document.addEventListener('click', function(e) {
var el = e.target.closest('[data-onetrust="true"]');
if (!el) return;
e.preventDefault();
e.stopPropagation();
if (typeof OneTrust !== 'undefined') {
OneTrust.showPreferencesUI('self');
}
});
And update the href to javascript:void(0) in the HBS.

Option A is less code and more robust if OneTrust is already loaded via GTM. Do you know which approach the team prefers, or whether OneTrust's SDK is already available on the deployed site?

@JakeSCahill JakeSCahill requested a review from Feediver1 April 29, 2026 15:15
Adds cookie preferences link to footer-content.hbs to align with other Redpanda web properties. The link allows users to manage their cookie consent settings, including CCPA opt-out options.

The footer is already rendered site-wide through existing partials:
- Home page: via home.hbs
- Article pages: via main.hbs
- Search/lab pages: via their respective layouts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@Feediver1 Feediver1 left a comment

Choose a reason for hiding this comment

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

Thx Jake.
Unable to verify Cookie preferences link. Will check after merge to see if it works. If not, will re-open.

@JakeSCahill JakeSCahill merged commit b6ca74c into main Apr 29, 2026
6 checks passed
@JakeSCahill JakeSCahill deleted the DOC-2102 branch April 29, 2026 15:57
@Feediver1 Feediver1 restored the DOC-2102 branch April 29, 2026 17:51
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