-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add bug report and feedback forms to help menu #154
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
Conversation
Users can now report bugs or submit feedback directly from the help menu. Forms collect title and description, then open the community forum with pre-filled content in a new tab. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to Preview Branch (feature/help-menu-bug-feedback-forms) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
Code Review - PR #154: Bug Report and Feedback FormsOverall AssessmentThis is a solid feature addition that improves user engagement by providing structured feedback mechanisms. The implementation is clean and follows the project's patterns well. However, there are several areas for improvement around validation, accessibility, test coverage, and UX. ✅ Strengths
🐛 Potential Issues1. Missing Input Validation (Medium Priority)The forms allow empty/whitespace-only descriptions to be submitted: // Line 206 & 246: Only validates title, not description
disabled={!bugTitle.trim()}
disabled={!feedbackTitle.trim()}Recommendation: Also validate that descriptions are non-empty: disabled={!bugTitle.trim() || !bugDescription.trim()}2. Potential XSS via URL Parameters (High Priority - Security)The // Lines 58-75
const params = new URLSearchParams({
title: title,
body: bodyTemplate
});While const MAX_TITLE_LENGTH = 200;
const MAX_DESCRIPTION_LENGTH = 5000;3. Broken Test Coverage (High Priority)The existing test file has failing tests due to the PR changes:
Impact: CI will fail or tests need updating to match new behavior. 4. No Tests for New Functionality (Medium Priority)Missing test coverage for:
🎯 Code Quality Suggestions1. Extract Form Components (Refactoring)The component is now 230+ lines. Consider extracting:
This would improve maintainability and testability. 2. Type Safety for Form StateConsider using a discriminated union for clearer type safety: type FormState =
| { type: 'none' }
| { type: 'bug'; title: string; description: string }
| { type: 'feedback'; title: string; description: string };3. Add Loading State for SubmissionsCurrently, there's no indication that the form was submitted. Consider:
4. Accessibility: Form Validation FeedbackWhen the submit button is disabled, users don't know why. Add helper text: {!bugTitle.trim() && (
<p className="text-sm text-muted-foreground">Title is required</p>
)}🧪 Test Coverage GapsRequired Test Updates:
Example test structure: describe('Bug Report Form', () => {
it('shows bug report form when button clicked', async () => {
// Test form appears
});
it('disables submit when title is empty', async () => {
// Test validation
});
it('opens forum with correct URL parameters', async () => {
const openSpy = vi.spyOn(window, 'open');
// Fill form and submit
expect(openSpy).toHaveBeenCalledWith(
expect.stringContaining('tags=bug'),
'_blank',
'noopener,noreferrer'
);
});
});📊 Performance ConsiderationsNo major performance concerns, but consider:
🔒 Security Review
📝 Recommended ChangesMust Fix (Blocking):
Should Fix (High Priority):
Nice to Have:
📚 Alignment with CLAUDE.md✅ Uses semantic tokens consistently Final RecommendationApprove with changes requested. The feature works well and the code quality is good, but the broken tests and missing validation need to be addressed before merge. Once tests are updated and validation is added, this will be a solid addition to the app. Great work on the UX flow with the back button and form state management! 🎉 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #154 +/- ##
==========================================
+ Coverage 86.66% 86.79% +0.12%
==========================================
Files 115 115
Lines 14387 14521 +134
Branches 2211 2230 +19
==========================================
+ Hits 12469 12603 +134
Misses 1918 1918
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
- Require both title and description before enabling submit - Add maxLength limits (200 for title, 5000 for description) - Truncate input in URL builder to prevent overflow - Increase help button size from 36px to 48px for better mobile tap target - Update tests: replace old feedback link test with button tests - Add tests for bug report form, feedback form, validation, and reset Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review✅ Strengths1. Excellent User Experience
2. Strong Input Validation
3. Comprehensive Test Coverage
4. Accessibility
5. Security Best Practices
🔍 Observations & Minor Suggestions1. Design System Compliance ✅
2. URL Length Limits (Low Priority)
However, this is not a blocker because:
Optional enhancement for future: Consider warning users if approaching URL length limits, but this is low priority. 3. State Management ✅
4. Form Validation UX (Enhancement Idea) {(!bugTitle.trim() || !bugDescription.trim()) && (
<p className="text-xs text-muted-foreground">Please fill in both fields</p>
)}But this is not critical - disabled state is standard UI pattern. 🎯 Best Practices AlignmentFollows CLAUDE.md Guidelines:
📊 Performance
🔐 Security
🧪 Testing
🎉 SummaryThis is high-quality work that's ready to merge. The implementation is clean, well-tested, accessible, and follows all project conventions. The bug reporting and feedback flow will significantly improve user engagement. Recommendation: ✅ Approve and Merge The code is production-ready with no blocking issues. The minor observations above are just suggestions for potential future enhancements, not required changes. |
Increase muted-foreground lightness from 55% to 65% in dark mode. This improves the contrast ratio from ~4.7:1 to ~7.5:1, making secondary text more readable while maintaining visual hierarchy. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pull Request ReviewThank you for this feature addition! I've reviewed PR #154 and here's my comprehensive feedback: ✅ StrengthsCode Quality
User Experience
Security
🔍 Issues & Recommendations1. Potential XSS via Forum URL (Medium Priority)The Current code (line 60-75): const buildForumUrl = (type: 'bug' | 'feature', title: string, description: string) => {
const truncatedTitle = title.slice(0, MAX_TITLE_LENGTH);
const truncatedDescription = description.slice(0, MAX_DESCRIPTION_LENGTH);
// ... builds URL with URLSearchParams
};Recommendation: Add explicit sanitization before URL construction: const sanitizeInput = (input: string): string => {
return input.replace(/[<>"']/g, ''); // Remove common XSS characters
};
const buildForumUrl = (type: 'bug' | 'feature', title: string, description: string) => {
const sanitizedTitle = sanitizeInput(title.slice(0, MAX_TITLE_LENGTH));
const sanitizedDescription = sanitizeInput(description.slice(0, MAX_DESCRIPTION_LENGTH));
// ... rest of function
};2. No User Feedback After Submission (Low Priority)After clicking "Submit to Forum", users are redirected but the dialog remains open with filled inputs. This could be confusing. Current behavior:
Recommendation: Add feedback and cleanup: const handleSubmitBug = () => {
const url = buildForumUrl('bug', bugTitle, bugDescription);
window.open(url, '_blank', 'noopener,noreferrer');
// Option 1: Reset form after short delay
setTimeout(() => resetForms(), 500);
// Option 2: Show success toast
toast.success('Redirected to forum\!');
setTimeout(() => resetForms(), 1000);
};3. Button Size Change May Affect Mobile UX (Low Priority)The help button size increased from Before: 36x36px Recommendation: Test on mobile devices or add responsive sizing: className="fixed bottom-4 right-4 h-10 w-10 sm:h-12 sm:w-12 rounded-full..."4. CSS Color Change Lacks Context (Low Priority)
Impact: All muted text throughout the app will be lighter 5. Missing Edge Case Handling (Low Priority)If Recommendation: Add fallback: const handleSubmitBug = () => {
const url = buildForumUrl('bug', bugTitle, bugDescription);
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
if (\!newWindow || newWindow.closed || typeof newWindow.closed === 'undefined') {
// Popup blocked
toast.error('Please allow popups for this site or copy this URL: ' + url);
}
};6. Test Assertion Could Be More Specific (Very Low Priority)Lines 311-320 in tests check that Current: expect(windowOpenSpy).toHaveBeenCalledWith(
expect.stringContaining('https://forum.openhamprep.com/new-topic'),
'_blank',
'noopener,noreferrer'
);Enhanced version: const call = windowOpenSpy.mock.calls[0][0];
expect(call).toContain('https://forum.openhamprep.com/new-topic');
expect(call).toContain('category=feedback');
expect(call).toContain('tags=bug');
expect(call).toContain('title=Test%20bug'); // URL encoded📋 Checklist Before Merge
🎯 SummaryThis is a solid feature implementation with excellent test coverage and good UX design. The main concern is potential XSS through the forum URL construction (though Recommendation: ✅ Approve with minor suggestions The code is production-ready, but implementing the sanitization layer would provide defense-in-depth. The other suggestions are nice-to-haves that can be addressed in follow-up PRs. Great work on the comprehensive test suite! 🎉 |
Swap tab order so Feedback tab appears first (left) and Shortcuts tab appears second (right). Feedback is already the default tab. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Bug Report and Feedback FormsGreat work on adding these user-facing feedback mechanisms! The implementation is solid overall. Here's my detailed feedback: ✅ Strengths
🐛 Potential Issues1. URL Encoding Vulnerability (Medium Priority)// Line 60-76: buildForumUrl function
const params = new URLSearchParams({
category: 'feedback',
title: truncatedTitle,
tags: tag,
body: bodyTemplate
});Issue: While URLSearchParams handles basic encoding, user input is directly embedded into the body template without sanitization. Special markdown characters could break forum formatting. Recommendation: Add input sanitization for markdown special characters or at minimum document this behavior. 2. Missing User Feedback After Submit (Low Priority)const handleSubmitBug = () => {
const url = buildForumUrl('bug', bugTitle, bugDescription);
window.open(url, '_blank', 'noopener,noreferrer');
};Issue: No visual feedback that the action succeeded. If popup blockers prevent window.open, users get no indication. Recommendation:
3. Inconsistent Button Sizing (Visual)Line 114: Help button changed from Question: Was this intentional? The PR description doesn't mention this change. It makes the button significantly larger (75% increase in area). 🎨 Code Quality ObservationsGood Practices:
Minor Suggestions:1. Extract Form Components (Optional) 2. Test Improvement (Line 311-320) // Current - two separate assertions
expect(windowOpenSpy).toHaveBeenCalledWith(
expect.stringContaining('https://forum.openhamprep.com/new-topic'),
'_blank', 'noopener,noreferrer'
);
expect(windowOpenSpy).toHaveBeenCalledWith(
expect.stringContaining('tags=bug'),
'_blank', 'noopener,noreferrer'
);
// Suggestion - single comprehensive assertion
expect(windowOpenSpy).toHaveBeenCalledOnce();
expect(windowOpenSpy).toHaveBeenCalledWith(
expect.stringMatching(/https:\/\/forum\.openhamprep\.com\/new-topic.*tags=bug/),
'_blank', 'noopener,noreferrer'
);🔒 Security Review✅ Good: Using ⚡ Performance ConsiderationsNo concerns - component is lightweight and forms are small. 🎯 Recommendations SummaryMust Fix Before Merge:
Should Consider:
Nice to Have:
📋 Test Plan ReviewThe test plan in the PR description is thorough. Verified all scenarios are covered by automated tests. ✅ Overall AssessmentApproval Status: ✅ Approved with suggestions This is a solid feature implementation that improves user feedback channels. The code quality is good, tests are comprehensive, and it follows project conventions. The suggestions above are enhancements rather than blockers. Great job! 🎉 |
- Add toast notifications for successful forum submission - Handle popup blockers with error toast when window.open returns null - Reset form and return to options view after successful submit - Stabilize dialog height (340px) to prevent jumping between tabs - Increase help button icon size (size-8) for better proportions - Improve test assertions with single comprehensive regex match - Add tests for popup blocked scenario and form reset after submit Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pull Request ReviewSummaryThis PR adds bug report and feedback forms to the Help menu, allowing users to submit issues and suggestions directly to the community forum. The implementation is well-structured with comprehensive test coverage. ✅ Strengths1. Excellent Test Coverage
2. Strong Accessibility
3. Good UX Patterns
4. Follows Project Conventions
🔍 Suggestions for Improvement1. Code Duplication (Minor) The bug and feedback form UIs are nearly identical (~50 lines duplicated at lines 252-303 and 305-356). Consider extracting a shared FeedbackForm component to reduce the component from ~360 to ~280 lines and improve maintainability. This is optional and non-blocking. 2. URL Building Safety (Low Priority) The buildForumUrl function (line 61) doesn't sanitize user input beyond truncation. While URL encoding via URLSearchParams protects against most issues, consider sanitizing line breaks and excessive whitespace for cleaner forum posts. 3. Form State Management (Minor) With 5 separate state variables (lines 80-85), consider using useReducer for cleaner state management. This would make the reset logic more atomic and reduce potential for inconsistent state. 4. Missing Edge Case Test Consider adding a test for maximum length validation to verify that titles and descriptions exceeding MAX_TITLE_LENGTH (200) and MAX_DESCRIPTION_LENGTH (5000) are properly truncated in the generated URL. 5. Help Button Size Change The help button size increased from h-9 w-9 to h-12 w-12 (line 143). Was this intentional? If so, consider mentioning it in the PR description. If not, this might be worth reverting to maintain consistency. 🔒 Security Review✅ No security concerns identified
🎨 Design System Compliance✅ Excellent adherence to project guidelines
The minor muted-foreground color adjustment in index.css (220 15% 55% to 220 15% 65%) improves contrast in dark mode. Good attention to accessibility. 📊 Performance ConsiderationsNo performance concerns - The component:
🧪 Test Coverage AssessmentExcellent coverage with tests for:
Minor gap: No test for maximum length truncation in buildForumUrl. 🎯 Overall AssessmentThis is a high-quality PR that is ready to merge with minor optional improvements. Pros:
Cons:
Recommendation: ✅ APPROVE with optional follow-up refactoring The code duplication is acceptable for this scope, and the feature provides immediate value. Consider the refactoring suggestions for a future cleanup PR if the forms evolve further. 📝 Testing ChecklistBefore merging, please verify:
Great work on this feature! 🎉 |
- Use fixed height (h-[340px]) instead of min-height for tab content to prevent dialog from shifting when switching tabs or views - Remove popup blocker detection since browsers handle this natively - Always show success toast and reset form after submit - Consolidate duplicate reset form tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review for PR #154Thanks for this contribution! Overall, this is well-implemented with excellent test coverage. ✅ Strengths
🔍 Issues & Suggestions
🎨 Design System ✅Excellent adherence - semantic tokens, shadcn/ui components, consistent spacing. CSS contrast improvement is great! 🚀 Performance & 🔒 Security ✅No issues. Minimal state, no unnecessary re-renders, no XSS vulnerabilities. 📝 Follow-up Ideas (not blockers)
✅ VerdictApproved with minor suggestions. High-quality work following all conventions with excellent tests, accessibility, and security. Great job! 🎉 Files: HelpButton.tsx (+230/-35), HelpButton.test.tsx (+273/-9), index.css (+1/-1) |
- Consolidate shortcuts into 2 sections: Answer Selection + Navigation - Display answer keys (A, B, C, D) in horizontal compact grid - Remove "Tools" section (merged with Navigation) - Update tests for new section names Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review - PR #154: Bug Report and Feedback FormsThank you for this comprehensive feature addition! Overall, this is a well-implemented PR with excellent test coverage and thoughtful UX considerations. Here's my detailed review: ✅ Strengths1. Excellent Test Coverage
2. Good UX Design
3. Accessibility
4. Code Quality
5. Design System Compliance
🔍 Issues & SuggestionsHigh Priority1. Missing Input Sanitization (Security)const buildForumUrl = (type: 'bug' | 'feature', title: string, description: string) => {
const truncatedTitle = title.slice(0, MAX_TITLE_LENGTH);
const truncatedDescription = description.slice(0, MAX_DESCRIPTION_LENGTH);
// ...
}Issue: User input is truncated but not sanitized before being added to URL parameters. While Suggestion: const truncatedTitle = title.trim().slice(0, MAX_TITLE_LENGTH);
const truncatedDescription = description.trim().slice(0, MAX_DESCRIPTION_LENGTH);The validation at HelpButton.tsx:286 and HelpButton.tsx:339 uses 2. URL Length LimitationURLs have practical length limits (~2000 chars for broad compatibility). With a 5000 character description limit, the generated URL could exceed browser limits. Suggestion: Consider reducing const url = buildForumUrl('bug', bugTitle, bugDescription);
if (url.length > 2000) {
toast({
title: 'Content too long',
description: 'Please shorten your description.',
variant: 'destructive'
});
return;
}Medium Priority3. Duplicate State ManagementYou maintain separate state for bug and feedback forms: const [bugTitle, setBugTitle] = useState('');
const [bugDescription, setBugDescription] = useState('');
const [feedbackTitle, setFeedbackTitle] = useState('');
const [feedbackDescription, setFeedbackDescription] = useState('');Suggestion: Consider consolidating into a single form state since they're never shown simultaneously: const [formData, setFormData] = useState({ title: '', description: '' });This reduces state complexity and ensures consistent behavior. 4. Toast Import Locationimport { toast } from '@/hooks/use-toast';Per CLAUDE.md patterns, ensure this import path is correct. Typically shadcn/ui toast would be imported from 5. Window.open Error Handlingconst handleSubmitBug = () => {
const url = buildForumUrl('bug', bugTitle, bugDescription);
window.open(url, '_blank', 'noopener,noreferrer');
toast({
title: 'Opening forum',
description: 'Complete your bug report in the new tab.',
});
resetForms();
};Issue: The code assumes const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
if (newWindow) {
toast({
title: 'Opening forum',
description: 'Complete your bug report in the new tab.',
});
resetForms();
} else {
// Still show the toast, but user may need to allow popups
toast({
title: 'Opening forum',
description: 'If a new tab didn\'t open, check your popup blocker settings.',
variant: 'default'
});
}Low Priority6. Magic String DuplicationThe forms for bug and feedback are nearly identical (HelpButton.tsx:242-294 vs 295-347). Consider extracting a shared form component: const FeedbackForm = ({
type,
title,
description,
onTitleChange,
onDescriptionChange,
onSubmit,
onBack
}: FeedbackFormProps) => { /* ... */ }This would reduce duplication and make the component easier to maintain. 7. Test ImprovementsYour tests are excellent, but consider adding:
8. Accessibility EnhancementConsider adding <Input
id="bug-title"
autoFocus
placeholder="Brief summary of the issue"
// ...
/>📊 Additional ObservationsDark Mode Contrast ImprovementThe CSS change improving muted text contrast from 55% to 65% is excellent: --muted-foreground: 220 15% 65%; /* was 55% */This significantly improves readability (WCAG AA compliance) without sacrificing visual hierarchy. Keyboard Shortcuts ReorganizationThe consolidation of shortcuts into 2 sections and the horizontal answer key layout is a good UX improvement. It prevents scrollbars and makes the layout more scannable. 🎯 Performance ConsiderationsNo significant performance concerns. The component:
🔒 Security AssessmentGenerally secure, with minor improvements needed:
📝 Final Recommendations
Verdict: ✅ Approve with minor changesThis is a solid feature implementation with excellent test coverage and good UX. The suggested changes are mostly defensive programming improvements. Once you address the high-priority items (input sanitization and URL length), this is ready to merge. Great work on the iterative improvements through the commit history - the evolution from basic forms → validation → tests → UX polish shows thoughtful development! 🎉 |
Summary
tags=bug, feedback usestags=featureTest plan
tags=feature🤖 Generated with Claude Code