-
Notifications
You must be signed in to change notification settings - Fork 45
Bug RHOAIENG-39106: Make URLs clickable in chat messages #533
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
base: main
Are you sure you want to change the base?
Bug RHOAIENG-39106: Make URLs clickable in chat messages #533
Conversation
Add custom anchor component to ReactMarkdown defaultComponents to ensure URLs in chat messages are rendered as clickable hyperlinks. Changes: - Add custom 'a' component to defaultComponents in message.tsx - Configure links to open in new tab (target="_blank") - Add security headers (rel="noopener noreferrer") - Apply primary color styling with hover underline effect The remarkGfm plugin auto-links URLs, but without a custom anchor component they weren't properly styled or configured for external links. This fix ensures all URLs are clickable and open safely in new tabs. Fixes: https://issues.redhat.com/browse/RHOAIENG-39106
Claude Code ReviewSummaryThis PR adds clickable URL functionality to chat messages by implementing a custom anchor component in the markdown renderer. The implementation is clean, secure, and follows established patterns, with no critical issues identified. Issues by Severity🚫 Blocker IssuesNone identified. ✅ 🔴 Critical IssuesNone identified. ✅ 🟡 Major IssuesNone identified. ✅ 🔵 Minor Issues1. Missing Type Safety for Anchor PropsLocation: Current Code: a: ({ href, children }) => (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline cursor-pointer"
>
{children}
</a>
),Issue: The anchor component parameters lack explicit type annotations, using implicit Recommendation: a: ({ href, children }: { href?: string; children?: React.ReactNode }) => (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline cursor-pointer"
>
{children}
</a>
),Why it matters: Frontend standards mandate zero Severity: Minor - The code works correctly and types are inferred, but explicit types align better with project standards. Positive Highlights✅ Security Best Practices
✅ Consistent Design System Integration
✅ Correct Pattern Usage
✅ Minimal, Focused Change
Code Quality AssessmentAdherence to CLAUDE.md patterns: ✅ Excellent
Security standards: ✅ Excellent
Architecture alignment: ✅ Good
RecommendationsPriority 1: Add Explicit Type Annotations (Optional)While not blocking, adding type annotations would align with the "Zero a: ({ href, children }: { href?: string; children?: React.ReactNode }) => (
// ... rest of component
)Priority 2: Consider Testing CoverageThe PR description mentions manual testing, but consider adding:
Pre-Commit Checklist ReviewChecking against Frontend Pre-Commit Checklist from CLAUDE.md:
Final VerdictApprove with minor suggestion. ✅ This PR is ready to merge as-is. The implementation is secure, follows project patterns, and solves the stated problem effectively. The only suggestion is to add explicit type annotations to align with the "Zero Impact: Low risk, high value
Additional ContextRelated Standards:
Files Reviewed:
Recommendation: Merge after optional type annotation improvement, or merge as-is if team accepts implicit typing for component props. 🤖 Generated with Claude Code 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
Summary
Fixes URLs not being rendered as clickable hyperlinks in chat messages.
Changes
a) component todefaultComponentsinmessage.tsxtarget="_blank")rel="noopener noreferrer")Technical Details
The
remarkGfmplugin auto-links URLs in markdown, but without a custom anchor component they weren't properly styled or configured for external links. This fix ensures all URLs are:noopener noreferrer)Testing
Verified that:
Related Issue
Fixes: https://issues.redhat.com/browse/RHOAIENG-39106
🤖 Generated with Claude Code