-
Notifications
You must be signed in to change notification settings - Fork 291
feat: add click-to-open functionality for images in markdown content #5301
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?
Conversation
Images in comments and other markdown content can now be clicked to open in a new tab, matching the existing behavior for post thumbnail images.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude please review this pr |
|
Claude finished @nimrodkra's task in 1m 17s —— View job Code Review
SummaryThe implementation is clean and straightforward, adding click-to-open functionality for images in markdown content. The changes are minimal and focused. ✅ What's Good
🔍 Observations & Considerations1. Event PropagationThe
Location: 2. Missing
|
preventDefault is unnecessary for img elements (no default behavior). stopPropagation prevents click from bubbling to parent handlers.
|
@claude do a 2nd round of review for this pr |
|
Claude finished @nimrodkra's task in 1m 24s —— View job 2nd Round Code Review
Changes Since First ReviewGood news - the author addressed one of the concerns from the first review! The code was updated to use
2nd Round Findings✅ Strengths
🔍 Issues & Considerations1. Missing Accessibility (Critical) 🚨 Images are now interactive but lack keyboard and screen reader support:
Impact: Users relying on keyboards or screen readers cannot open images. Location: Fix accessibility →%20Adding%20onKeyDown%20handler%20to%20check%20for%20Enter%2FSpace%20keys%202)%20Adding%20tabindex%3D%220%22%20to%20images%20via%20CSS%20or%20runtime%203)%20Adding%20role%3D%22button%22%20to%20images%204)%20Adding%20focus-visible%20styles%20in%20markdown.module.css&repo=dailydotdev/apps) 2. Event Delegation Concern The onClick={onImageClick} // On the wrapper divIf Test: Verify that clicking images inside nested elements (like a Location: 3. Missing Null Check on
const newWindow = window.open(element.src, '_blank', 'noopener,noreferrer');
if (!newWindow) {
// Fallback: could show a toast or copy link to clipboard
}Location: 4. No Test Coverage There are no tests for the Markdown component at all (
Suggestion: Consider adding at least basic tests for this new functionality. 5. Cursor Pointer on Non-Images The CSS applies Location: 6. No Loading State or Error Handling When
This is minor but could improve UX. Edge Cases to Test
RecommendationsPriority:
Comparison with First ReviewThe first review mentioned:
Final VerdictConditional Approval - The implementation is functional and the propagation fix was good, but the missing accessibility support is a significant gap that should be addressed before merging. Images that act as buttons need keyboard support and proper ARIA attributes to meet accessibility standards. The code quality is solid, security is handled properly, and the feature works as intended for mouse users. Once accessibility is added, this would be ready to ship. |
- Fix prettier formatting for isImageElement function - Add eslint-disable comment for accessibility rules since images in dangerouslySetInnerHTML cannot be made focusable without modifying the markdown rendering pipeline (planned as follow-up work)
- Add useEffect to set accessibility attributes on images after render: - tabindex="0" for keyboard navigation - role="button" to indicate interactivity - aria-label="Open image in new tab" for screen readers - Add onKeyDown handler for Enter/Space key activation - Add focus-visible styles with ring indicator for keyboard users - Extract openImageInNewTab helper function for reuse This addresses the accessibility concerns from code review, ensuring keyboard and screen reader users can navigate and activate images.
|
@claude are we good to go? |
|
Claude finished @nimrodkra's task in 43s —— View job Final PR Assessment
✅ Yes, you're good to go!What Changed Since the 2nd ReviewGreat news! The critical accessibility issue from the 2nd review has been fully addressed in commit ✅ Full Accessibility Support Added
Code QualityThe implementation is now production-ready:
What Was Fixed
Minor NotesThe only items not addressed from the 2nd review are:
These are not blockers for merging. Recommendation✅ APPROVED - This PR is ready to merge. All critical issues have been resolved, and the feature now meets accessibility standards while maintaining clean, secure code. |
idoshamun
left a comment
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.
I think it's possible to bake this functionality to our markdown renderer rather than adding it here. Something I'd check before merging
Summary
Test plan
Preview domain
https://feat-clickable-comment-images.preview.app.daily.dev