-
Notifications
You must be signed in to change notification settings - Fork 191
feat: show feedback widget on NFC scan issues #948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
transphorm
merged 2 commits into
feat/sentry-feedback
from
codex/review-pull-request-for-feedback-modal
Aug 25, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid stacking Sentry widget on top of an error modal. Queue it for after modal dismissal.
Opening a modal and the Sentry widget simultaneously risks UI overlap, focus traps, or inaccessible flows. Trigger the widget after the error modal closes (or make it the primary action), not immediately on error/timeout.
scanTimeoutRef.current = setTimeout(() => { trackEvent(PassportEvents.NFC_SCAN_FAILED, { error: 'timeout' }); openErrorModal('Scan timed out. Please try again.'); - showFeedbackModal('widget'); setIsNfcSheetOpen(false); }, 30000);And change the modal to trigger the widget on dismiss:
const openErrorModal = useCallback( (message: string) => { showModal({ titleText: 'NFC Scan Error', bodyText: message, buttonText: 'Send Feedback', secondaryButtonText: 'Help', preventDismiss: false, - onButtonPress: () => sendFeedbackEmail(message), + onButtonPress: () => sendFeedbackEmail(message), onSecondaryButtonPress: goToNFCTrouble, - onModalDismiss: () => {}, + onModalDismiss: () => showFeedbackModal('widget'), }); }, - [showModal, goToNFCTrouble, sendFeedbackEmail], + [showModal, goToNFCTrouble, sendFeedbackEmail, showFeedbackModal], );Also applies to: 327-327
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we showing the feedback modal again onModalDismiss? this seems like an anti pattern to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@transphorm You're absolutely right - automatically showing a feedback modal on dismiss is indeed an anti-pattern. Users dismiss modals to return to the main flow, not to be confronted with another modal. This violates user agency and creates an intrusive experience.
Looking at the code, you already have a "Report issue" button in the main UI that triggers
showFeedbackModal('widget'), which is the proper user-initiated approach.For the error cases (timeout and scan failures), I'd suggest one of these cleaner alternatives:
Option 1: Remove automatic feedback entirely
Option 2: Replace the "Send Feedback" button with widget feedback
The existing "Report issue" button provides a clear, user-controlled path for feedback without being pushy about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok nice at least we are on the same page now. can you provide a full prompt for me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@transphorm Here's the complete code solution to remove the anti-pattern and provide a clean feedback flow:
1. Update the timeout handler:
2. Update the error catch block:
3. Update the openErrorModal function:
4. Remove the sendFeedbackEmail callback dependency from onVerifyPress:
This approach gives users clear control over when they want to provide feedback while avoiding the intrusive automatic modal stacking.