Skip to content

fix(feedback): don't let a missing widget turn Feedback into a no-op - #1531

Open
masiarek wants to merge 1 commit into
Equal-Vote:mainfrom
masiarek:fix/1080-feedback-widget-guard
Open

masiarek wants to merge 1 commit into
Equal-Vote:mainfrom
masiarek:fix/1080-feedback-widget-guard

Conversation

@masiarek

Copy link
Copy Markdown
Collaborator

Description

Refs #1080. openFeedback() reaches into the feedback widget's iframe and clicks the button inside it, with no guard at any step:

const launcherFrame = document.getElementById("launcher-frame");
const button = (launcherFrame as HTMLIFrameElement).contentWindow.document
    .getElementsByClassName("launcher-button")[0];
(button as HTMLButtonElement).click();

If the widget has not loaded — blocked, slow, or stopped by a browser's tracking protection, which is the usual story on iOS — launcherFrame is null and this throws. The Feedback menu item then does nothing at all, and the only trace is a console error no user will see. Reading the iframe's document can throw outright too.

Each step is now optional-chained inside a try, and when the widget cannot be reached the click falls back to a mailto: rather than failing silently.

What this is and isn't

I could not reproduce the iPhone case — no device. This fixes the failure mode the code makes possible, which matches the symptom in the video (tapping Feedback does nothing). If the widget is loading on that phone and the button is being clicked, the cause is elsewhere and this change only removes a way for it to fail quietly.

Worth a second opinion on the fallback address: I used elections@equal.vote, which is the contact address already used elsewhere in en.yaml. If there is a better destination for feedback specifically, say the word.

Related Issues

Refs #1080

openFeedback() reaches into the feedback widget's iframe and clicks the
button inside it, with no guard at any step:

  const launcherFrame = document.getElementById("launcher-frame");
  const button = (launcherFrame as HTMLIFrameElement).contentWindow.document
      .getElementsByClassName("launcher-button")[0];
  (button as HTMLButtonElement).click();

If the widget hasn't loaded — blocked, slow, or prevented by a browser's
tracking protection, which is the usual story on iOS — then launcherFrame
is null and this throws a TypeError. The Feedback menu item does nothing at
all, and the only trace is a console error the user never sees. Reading the
iframe's document can also throw outright.

Each step is now optional-chained inside a try, and when the widget cannot
be reached the click falls back to a mailto: to elections@equal.vote rather
than silently failing.

I could not reproduce Equal-Vote#1080 on an iPhone — no device — so this is a fix for
the failure mode the code makes possible, not a confirmed reproduction of
the one in the video. If the widget IS loading on that phone and the button
is being clicked, the cause is elsewhere and this only removes a way for it
to fail quietly.
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@masiarek, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 86ba7d3d-9921-407d-bab6-6ac72bf3e4a9

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc75a8 and d9385d9.

📒 Files selected for processing (1)
  • packages/frontend/src/components/util.tsx

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.

@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for bettervoting ready!

Name Link
🔨 Latest commit d9385d9
🔍 Latest deploy log https://app.netlify.com/projects/bettervoting/deploys/6a80abc7963eb000080d4e78
😎 Deploy Preview https://deploy-preview-1531--bettervoting.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

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.

1 participant