Skip to content

Feedback widget#237

Open
ribiza wants to merge 17 commits into
masterfrom
feedback-widg
Open

Feedback widget#237
ribiza wants to merge 17 commits into
masterfrom
feedback-widg

Conversation

@ribiza

@ribiza ribiza commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator
  • Two ways of leaving feedback: via a modal accessed through the Feedback bottom-right floating button, or via thumb up/down buttons in the footer of each page. Clicking the thumbs up in the footer directly sends the feedback, while thumbs down invites people to elaborate via the modal. The dependency docusaurus-pushfeedback is for the modal, pushfeedback-react is for the footer widget.
  • Submitting feedback via the modal will make the thumbs up/down in the footer unavailable, as feedback for the page has already shipped.
  • Code valid/invalid css no longer overrides danger/success docusaurus colors, so the latter can be reused by the feedback widget. While I was doing it, I also stabilized some flaky class names.
  • `DocItem/Footer1 had previously been ejected. I have wrapped it under the latest version, as recommended by the PushFeedback docs. I also couldn't spot any obvious custom features in it, and visually it made no change.

PushFeedback has a 25 feedback entries for free. Let's see how this plays out.

@coderabbitai

coderabbitai Bot commented Jul 15, 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: CHILL

Plan: Pro

Run ID: ea8b15f1-f430-4ee7-b0cd-ee31ba95f2ee

📥 Commits

Reviewing files that changed from the base of the PR and between 419c6e3 and 8f991e2.

📒 Files selected for processing (2)
  • src/css/custom.scss
  • src/theme/DocItem/Footer/index.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/theme/DocItem/Footer/index.tsx
  • src/css/custom.scss
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Cloudflare Pages

📝 Walkthrough

Walkthrough

The PR integrates PushFeedback into the Docusaurus document footer, adds feedback widget styling and submission handling, updates code-block theme selectors, and ignores package-lock.json.

Changes

Feedback and documentation UI

Layer / File(s) Summary
Feedback dependencies and configuration
.gitignore, package.json, docusaurus.config.js
PushFeedback dependencies and plugin settings are added, and package-lock.json is ignored.
Footer feedback widget
src/theme/DocItem/Footer/index.js, src/theme/DocItem/Footer/index.tsx, src/css/custom.scss
The footer renders rating controls, initializes PushFeedback elements, handles submission events, preserves the original footer, and displays confirmation or error messages.
Code example presentation and styling
src/css/custom.scss
Valid and invalid code blocks use theme variables and :has() selectors, with related layout, navbar, and selector formatting updates.

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

Sequence Diagram(s)

sequenceDiagram
  participant FooterWrapper
  participant FeedbackButton
  participant PushFeedback
  FooterWrapper->>FeedbackButton: render positive and negative controls
  FeedbackButton->>PushFeedback: submit rating
  PushFeedback-->>FooterWrapper: dispatch feedbackSent or feedbackError
  FooterWrapper->>FooterWrapper: update feedback status and render result
Loading

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploying docs-source-network with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f991e2
Status: ✅  Deploy successful!
Preview URL: https://a366a6cd.docs-source-network.pages.dev
Branch Preview URL: https://feedback-widg.docs-source-network.pages.dev

View logs

@ribiza
ribiza marked this pull request as ready for review July 16, 2026 04:32

@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

🧹 Nitpick comments (1)
src/css/custom.scss (1)

829-844: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use built-in button modifier classes instead of custom CSS.

Docusaurus uses the Infima CSS framework, which already provides semantic classes like .button--danger. You can safely remove these custom overrides and instead change the "No" button's class in src/theme/DocItem/Footer/index.js from button--primary to button--danger.

Additionally, this custom CSS lacks a text color declaration on :hover, which can cause the SVG icon to become invisible against the background color on hover.

♻️ Proposed fix to remove redundant CSS
-.feedback-widget-positive button {
-  color: var(--ifm-color-primary);
-  border-color: var(--ifm-color-primary);
-
-  &:hover, &:active {
-    background-color: var(--ifm-color-primary);
-  }
-}
-.feedback-widget-negative button {
-  color: var(--ifm-color-danger);
-  border-color: var(--ifm-color-danger);
-
-  &:hover, &:active {
-    background-color: var(--ifm-color-danger);
-  }
-}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/css/custom.scss` around lines 829 - 844, Remove the custom
.feedback-widget-positive button and .feedback-widget-negative button styles
from the stylesheet, and update the “No” button in the DocItem Footer component
from button--primary to Infima’s button--danger modifier. Preserve the existing
positive button styling through its built-in class and ensure the negative
button uses the semantic danger variant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitignore:
- Line 3: Remove package-lock.json from the ignore entries in .gitignore so the
application repository tracks and preserves the lockfile for reproducible
dependency installations.

In `@src/plugins/feedback.js`:
- Around line 1-45: Replace the vanilla DOM feedback plugin with React-managed
state: delete src/plugins/feedback.js entirely and remove its clientModules
entry from docusaurus.config.js at lines 200-201. In
src/theme/DocItem/Footer/index.js lines 1-7, import useState; refactor
FeedbackWidget at lines 8-40 to track submitted with useState, register and
clean up feedbackSent handling in useEffect, and conditionally render the
success message without manually removing React nodes. Change the “No” button
class from button--primary to button--danger.

---

Nitpick comments:
In `@src/css/custom.scss`:
- Around line 829-844: Remove the custom .feedback-widget-positive button and
.feedback-widget-negative button styles from the stylesheet, and update the “No”
button in the DocItem Footer component from button--primary to Infima’s
button--danger modifier. Preserve the existing positive button styling through
its built-in class and ensure the negative button uses the semantic danger
variant.
🪄 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: 660cac53-d88c-4a63-86df-cc1d14ea2eb0

📥 Commits

Reviewing files that changed from the base of the PR and between f5fb15a and 0ed4c76.

📒 Files selected for processing (6)
  • .gitignore
  • docusaurus.config.js
  • package.json
  • src/css/custom.scss
  • src/plugins/feedback.js
  • src/theme/DocItem/Footer/index.js
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (2)
src/{theme,css,code-theme}/**/*.{js,jsx,ts,tsx,scss,css}

📄 CodeRabbit inference engine (CLAUDE.md)

Custom theme components use Docusaurus swizzling with custom footer components, color mode toggle, SCSS styling in /src/css/custom.scss, and custom code theme in /src/code-theme/code-theme.js

Files:

  • src/theme/DocItem/Footer/index.js
  • src/css/custom.scss
docusaurus.config.js

📄 CodeRabbit inference engine (CLAUDE.md)

docusaurus.config.js: Changelog and release notes sidebar items should be automatically reversed (newest first) via the reverseSidebarChangelog() function in docusaurus.config.js
The site uses dark mode by default with respectPrefersColorScheme: false
GitHub edit links should be configured to point to the master branch
Algolia search is configured with app ID N3M9YBYYQY

Files:

  • docusaurus.config.js
🪛 ast-grep (0.44.1)
src/plugins/feedback.js

[warning] 42-42: Avoid using the initial state variable in setState
Context: setTimeout(registerFeedbackHandlers, 1000)
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(setstate-same-var)

🔇 Additional comments (3)
package.json (1)

27-29: LGTM!

docusaurus.config.js (1)

287-294: LGTM!

src/theme/DocItem/Footer/index.js (1)

42-49: LGTM!

Comment thread .gitignore
Comment thread src/plugins/feedback.js Outdated
@ribiza
ribiza requested a review from david-on-github July 16, 2026 10:48

@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

🧹 Nitpick comments (1)
src/theme/DocItem/Footer/index.tsx (1)

72-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add ARIA attributes for screen reader announcements.

Adding role="status" and aria-live="polite" ensures that screen readers dynamically announce the thank-you message when it appears after the user submits feedback.

♿ Proposed accessibility improvement
       {feedbackSent && (
-        <div className="feedback-thanks">Thanks for your feedback!</div>
+        <div className="feedback-thanks" role="status" aria-live="polite">Thanks for your feedback!</div>
       )}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/theme/DocItem/Footer/index.tsx` around lines 72 - 74, Add role="status"
and aria-live="polite" to the feedback-thanks div rendered by the feedbackSent
condition in the DocItem footer, so screen readers announce the thank-you
message when it appears.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/theme/DocItem/Footer/index.tsx`:
- Around line 87-93: Remove the onClick handler that calls setFeedbackSent(true)
from the feedback thumbs-up button in the FeedbackButton component. Let the
existing document-level feedbackSent event listener control unmounting only
after the web component successfully submits the feedback.

---

Nitpick comments:
In `@src/theme/DocItem/Footer/index.tsx`:
- Around line 72-74: Add role="status" and aria-live="polite" to the
feedback-thanks div rendered by the feedbackSent condition in the DocItem
footer, so screen readers announce the thank-you message when it appears.
🪄 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: d641bffa-8ded-4fe0-a4a6-6eb2cf391afb

📥 Commits

Reviewing files that changed from the base of the PR and between 52a7bc4 and 419c6e3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • src/css/custom.scss
  • src/theme/DocItem/Footer/index.js
  • src/theme/DocItem/Footer/index.tsx
  • src/theme/DocItem/Footer/styles.module.css
💤 Files with no reviewable changes (2)
  • src/theme/DocItem/Footer/styles.module.css
  • src/theme/DocItem/Footer/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/css/custom.scss
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (1)
src/{theme,css,code-theme}/**/*.{js,jsx,ts,tsx,scss,css}

📄 CodeRabbit inference engine (CLAUDE.md)

Custom theme components use Docusaurus swizzling with custom footer components, color mode toggle, SCSS styling in /src/css/custom.scss, and custom code theme in /src/code-theme/code-theme.js

Files:

  • src/theme/DocItem/Footer/index.tsx
🔇 Additional comments (1)
src/theme/DocItem/Footer/index.tsx (1)

78-111: 📐 Maintainability & Code Quality

Check the FeedbackButton prop casing. The current pushfeedback-react usage mixes kebab-case prop names with string booleans, which may not match the wrapper API.

Comment thread src/theme/DocItem/Footer/index.tsx Outdated

{/* Hidden rather than unmounted: feedback events emit on the host
element after the fetch resolves, so it must stay connected for the
document listeners (esp. feedbackError) to hear them */}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I was gonna comment on your previous commit as I had stumbled on the same issue, and adopted the same solution. Praise for having added a comment :)

Comment thread src/css/custom.scss
.feedback-widget-negative &:hover {
color: var(--src-red);
}
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
}
}
/* END Feedback widget */

Comment thread src/css/custom.scss
justify-content: center;
width: 40px;
height: 40px;
color: var(--foreground);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This var is undefined.

Comment thread src/css/custom.scss
height: 40px;
color: var(--foreground);
opacity: 0.8;
transition: all 0.3s ease;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This doesn't seem to have any effect - the hiding of one div and display of the other is instantaneous to me.

const handleError = (event: Event) => {
console.error(
"Feedback submission error:",
(event as CustomEvent<{ error: unknown }>).detail.error,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Q: What's the advantage of making this into a typed statement if the type is unknown?

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