Skip to content

feat(docs): add "was this page helpful?" feedback widget to docs pages - #507

Merged
EricAndrechek merged 6 commits into
mainfrom
docs-feedback
Aug 21, 2026
Merged

feat(docs): add "was this page helpful?" feedback widget to docs pages#507
EricAndrechek merged 6 commits into
mainfrom
docs-feedback

Conversation

@jfwoods

@jfwoods jfwoods commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a "Was this page helpful?" thumbs-up / thumbs-down widget below the content of every docs page, so we get a per-page signal on which pages actually land.

  • Event: clicking either thumb fires window.posthog?.capture('docs_feedback', { helpful, page })helpful is true/false, page is location.pathname (belt-and-braces; PostHog derives pathname itself). Guarded with ?. like every other capture on the site; PostHog.astro is untouched.
  • One vote per page per visitor: the choice is remembered in localStorage keyed by pathname, and a revisit renders the thanks message instead of re-prompting. Storage is a nicety, not the record — the capture is what counts, so a browser with storage disabled still votes (it just gets asked again).
  • Automatic on every page, present and future: it renders from Footer.astro's sidebar (doc-page) branch — the same indirection the Cloud CTA already uses — not from a per-page import or frontmatter flag. A new page under docs/src/content/docs/ gets the widget on its first build with zero authoring work.
  • Placement: below the Cloud CTA on pages that carry one, directly after the content on pages that don't, and above the edit-link / prev-next chrome either way. It owns no outer spacing or rule of its own — as a grid item of .wh-footer--compact it inherits that footer's gap, which is what keeps it aligned with the CTA above and the edit-link row below.
  • Excluded on splash pages: the homepage and 404 are template: splash, so they take the other footer branch and never render it. An explicit 404 id check keeps that true if the 404 page ever stops being a splash page.

Accessibility and theming follow the surrounding components: real <button>s with aria-labels, keyboard operable, the site's global :focus-visible ring, a role="status" thanks message that receives focus after a vote (the pressed button is display:none by then), and --wh-* design tokens throughout so it follows the theme in light and dark. The script uses the codebase's DOM-script convention (is:inline, IIFE, window init flag, one delegated click listener, re-render on both DOMContentLoaded and astro:page-load) so it survives view transitions without accumulating listeners.

The Footer.astro diff is 9 added lines in three hunks (import, one const, one JSX line), deliberately kept clear of the <DocsTracking /> region so it merges cleanly with #505.

Test plan

  • make build-docs exits 0 — astro check clean, starlight-links-validator clean, 21 pages built
  • make verify passes (run by the pre-commit hook on this commit's tree)
  • Widget markup present on 19/21 built pages; the only two without it are exactly dist/index.html (splash homepage) and dist/404.html
  • DOM order on a Cloud CTA page (deployment, durability): content → CloudCta → PageFeedback → edit link → prev/next
  • DOM order on a non-CTA page (getting-started): content → PageFeedback → edit link → prev/next
  • Widget renders as a sibling after .sl-markdown-content, not inside it, so markdown prose styles don't leak into it
  • Inline script emitted exactly once per page; docs_feedback appears once in the built HTML
  • Scoped [data-state="voted"] show/hide rules present in the built CSS bundle
  • markdownlint-cli2 CHANGELOG.md reports 0 issues
  • Visual check in the Cloudflare preview, light and dark theme, on a CTA page and a non-CTA page

Related Issues

None

A thumbs-up / thumbs-down vote below the page content on every docs page,
captured to PostHog as `docs_feedback` with `{ helpful, page }`.

It renders from Footer.astro's sidebar (doc-page) branch rather than a
per-page import or frontmatter flag — the same indirection the Cloud CTA
already uses — so every content page gets it automatically, including
pages not written yet. It sits below the Cloud CTA on the pages that
carry one, and above the edit-link / prev-next chrome. Splash pages (the
homepage and 404) take the other footer branch and never render it.

One vote per page per visitor: the choice is remembered in localStorage
keyed by pathname, and a revisit renders the thanks message instead of
re-prompting. Storage is a nicety, not the record — the capture is what
counts, so a browser with storage disabled still votes.

The widget owns no outer spacing or rule: as a grid item of
.wh-footer--compact it inherits that footer's gap, which is what keeps it
aligned with the Cloud CTA above and the edit-link row below.

Follows the codebase's DOM-script convention (is:inline, IIFE, window
init flag, one delegated click listener, re-render on both
DOMContentLoaded and astro:page-load) so it survives view transitions,
and the --wh-* design tokens so it follows the site theme in light and
dark.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation area/docs Documentation, site/, README labels Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 780e91fe-98f1-46da-945f-bdad2989d5e7

📥 Commits

Reviewing files that changed from the base of the PR and between 1a5aeab and 2400895.

📒 Files selected for processing (1)
  • docs/src/components/PageFeedback.astro

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🔇 Additional comments (2)
docs/src/components/PageFeedback.astro (2)

149-154: Confirm PostHog readiness before persisting the vote.

docs/src/components/PostHog.astro exposes capture before the SDK finishes initialization. If the loader is blocked, Line 149 still passes and Line 153 stores the vote although docs_feedback is never delivered. Use a readiness flag from the loader's supported initialization callback before calling rememberVote. Keep applyVote unconditional so the current visit remains usable.


50-50: LGTM!

Also applies to: 107-119, 141-142, 155-155


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a “Was this page helpful?” feedback widget to documentation pages, excluding 404 pages.
    • Visitors can submit thumbs-up or thumbs-down feedback and receive confirmation.
    • Feedback choices are remembered for each page and restored during navigation.
    • Visitors can change or retract their feedback.
    • The widget is responsive, accessible, and supports reduced-motion preferences.
  • Documentation

    • Added an Unreleased changelog entry describing the new feedback feature.

Walkthrough

Added a documentation feedback widget with thumbs-up/down voting, PostHog event capture, pathname-based localStorage persistence, navigation restoration, and a confirmation state. The widget renders in the compact footer except on 404 pages.

Changes

Documentation feedback

Layer / File(s) Summary
Feedback capture and persistence
docs/src/components/PageFeedback.astro, CHANGELOG.md
Added accessible thumbs-up/down controls, docs_feedback PostHog events, pathname-scoped localStorage persistence, Astro navigation restoration, vote changes and retractions, focus management, responsive styling, reduced-motion support, and a changelog entry.
Conditional footer rendering
docs/src/components/Footer.astro
Added the feedback component to the compact footer and disabled it for /404 and 404 page IDs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to 24008

The widget can mark a vote as completed even when the feedback event is not delivered, causing lost page feedback and preventing a visitor from retrying; the selected choice is also not exposed to assistive technology. Merge should wait for these issues to be addressed or explicitly accepted.

Suggested reviewers: ericandrechek

Sequence Diagram(s)

sequenceDiagram
  participant Visitor
  participant PageFeedback
  participant localStorage
  participant PostHog
  Visitor->>PageFeedback: Select thumbs-up or thumbs-down
  PageFeedback->>PostHog: Capture docs_feedback event
  PageFeedback->>localStorage: Store vote for pathname
  PageFeedback->>Visitor: Show confirmation state
Loading
🚥 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 feedback widget to documentation pages.
Description check ✅ Passed The description directly explains the widget, event capture, persistence, integration, accessibility, testing, and remaining visual check.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs-feedback
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch docs-feedback

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bf42c32e-b828-43b9-bee2-8a682c2193c7

📥 Commits

Reviewing files that changed from the base of the PR and between b65052e and a9bcbae.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • docs/src/components/Footer.astro
  • docs/src/components/PageFeedback.astro

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

  • Never hard-wrap prose. One paragraph is one line. No wrapping at 72/80 columns, no "semantic linefeeds" splitting a paragraph at sentence boundaries.

Files:

  • CHANGELOG.md
🔇 Additional comments (5)
docs/src/components/PageFeedback.astro (2)

18-56: LGTM!


139-159: 📐 Maintainability & Code Quality

No additional :focus-visible style is required. docs/src/styles/global.css already applies a visible focus outline to all focusable elements, including these vote buttons.

			> Likely an incorrect or invalid review comment.
CHANGELOG.md (1)

11-14: LGTM!

docs/src/components/Footer.astro (2)

19-19: LGTM!

Also applies to: 67-67


46-51: 🩺 Stability & Availability

Keep the direct entry.id access. Starlight defines entry as required and entry.id as a non-nullable string, including the 404 fallback entry.

			> Likely an incorrect or invalid review comment.

Comment thread docs/src/components/PageFeedback.astro Outdated
@github-project-automation github-project-automation Bot moved this from Backlog to In review in WaveHouse Task Board Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

📚 Docs preview is livehttps://a4270e22-wavehouse-docs.wave-rf.workers.dev

  • Commit2400895: fix(docs): add aria-pressed to vote buttons, fix retract localStorage clearing
  • Author@jfwoods
  • Committed — 2026-08-21 11:55 (UTC-04:00)
  • Deployed — 2026-08-21 11:58 EDT

If PostHog is blocked (ad blocker, consent banner, still loading), the
capture is a no-op — but rememberVote() ran anyway, locking the visitor
out of ever voting again with the event lost.  Gate persistence on
typeof capture === 'function' so the visitor is re-prompted instead.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fd69c41a-b3c1-4c74-b343-f4dcec63c023

📥 Commits

Reviewing files that changed from the base of the PR and between 09a94e6 and e51f3e9.

📒 Files selected for processing (1)
  • docs/src/components/PageFeedback.astro

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Docs build
  • GitHub Check: Lint
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
docs/src/components/PageFeedback.astro (1)

2-24: LGTM!

Also applies to: 27-56, 119-187

Comment thread docs/src/components/PageFeedback.astro
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 21, 2026
@jfwoods
jfwoods marked this pull request as ready for review August 21, 2026 13:37
@jfwoods
jfwoods requested review from a team and taitelee August 21, 2026 13:37

@EricAndrechek EricAndrechek 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.

My thoughts:

  • We should let them still see their feedback/change it after clicking – right now I have no way to see what I clicked or change my vote
  • It should send the vote with the current build id or commit sha or something, so we can pin down the version of the docs they liked or didn't like at that point in time
  • Similarly, if the docs change either on that page or generally or its a new commit sha or build id or whatever, let them re-vote (ie clear their last vote from localstorage/don't show it again)
  • I think the styling of the page needs to change, it looks weird in its current form. Maybe centered and less prominent/better matching the secondary colors/fonts, or remove the edit page link and put this where that was instead or something, replacing it with a link to open an issue or something if their adblocker or whatever isn't letting it load?

…xpiry

Address Eric's review:
- After voting, the chosen thumb stays highlighted and the other remains
  clickable to change the vote (fires a new capture with changed: true).
- Each capture includes the build SHA so feedback ties to a specific docs
  revision.
- Votes are scoped to the build SHA in localStorage; a new build clears
  stale votes so visitors can re-evaluate updated content.
- Centered, smaller, muted-color styling — less prominent than content.
Clicking the active thumb toggles it off — clears localStorage and fires
a docs_feedback capture with retracted: true and helpful: null so PostHog
can distinguish retractions from votes. The widget returns to the prompt
state.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dc040461-f608-4792-a42d-c613eef4046b

📥 Commits

Reviewing files that changed from the base of the PR and between e51f3e9 and 1a5aeab.

📒 Files selected for processing (1)
  • docs/src/components/PageFeedback.astro

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: Docs build
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
docs/src/components/PageFeedback.astro (1)

145-150: PostHog readiness remains unresolved.

A capture function can be the PostHog loader stub. Its presence does not confirm that the queued event will be delivered before this code persists the vote.

Comment thread docs/src/components/PageFeedback.astro
Comment thread docs/src/components/PageFeedback.astro Outdated
… clearing

- aria-pressed synced on render, vote, change-vote, and retract so
  screen readers can identify the selected thumb.
- localStorage.removeItem moved outside the PostHog capture guard in the
  retract path — if PostHog is blocked but a prior vote exists, the
  retract still clears storage so the visitor can re-vote on reload.
@EricAndrechek

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-project-automation github-project-automation Bot moved this from In review to In progress in WaveHouse Task Board Aug 21, 2026
@EricAndrechek
EricAndrechek added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main with commit 26cb857 Aug 21, 2026
20 checks passed
@EricAndrechek
EricAndrechek deleted the docs-feedback branch August 21, 2026 16:49
@github-project-automation github-project-automation Bot moved this from In progress to Done in WaveHouse Task Board Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation, site/, README documentation Improvements or additions to documentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants