Open QuantumDev-oss opened 3 months ago
Hey sorry to necrobump can either of you confirm if this issue, was occurring on iPadOS running safari? I experienced an issue identical to this and looking for confirmation.
Hey @kaokien I replied to your separate thread, thanks @QuantumDev-oss I'll look into including this.
/**
After further consideration, I believe we can make some additional improvements to our comment handling implementation. While the current solution is solid, here are some suggestions to enhance functionality, performance, and user experience:
Implement event delegation: Instead of attaching event listeners to each comment, we could use event delegation on the parent container. This would improve performance, especially for threads with many comments.
function addTapListener(element, callback) { element.addEventListener('click', callback); element.addEventListener('touchend', (e) => { e.preventDefault(); callback(e); }); }
function loadComments(startIndex, count) { // Fetch and render comments from startIndex to startIndex + count }
// Use Intersection Observer API for infinite scrolling const observer = new IntersectionObserver((entries) => { if (entries[0].isIntersecting) { loadComments(currentIndex, 20); } });
const expandedComments = new Set();
function handleCommentTap(commentId) { if (expandedComments.has(commentId)) { expandedComments.delete(commentId); } else { expandedComments.add(commentId); } updateCommentView(commentId); }
<div role="button" tabindex="0" aria-expanded={isExpanded} onKeyPress={(e) => e.key === 'Enter' && handleCommentTap(commentId)} onClick={() => handleCommentTap(commentId)}
.comment-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.comment-body.expanded { max-height: 1000px; / Adjust based on expected maximum height / }
These improvements would make the comment system more robust, performant, and user-friendly. Let's discuss these suggestions and prioritize them for upcoming sprints.