Solution#1749
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because the gallery behaves correctly: clicking any thumbnail (whether on the img or its surrounding a) updates the main image using event delegation on the .gallery container. The logic that finds the nearest anchor with closest('a') and then assigns mainImage.src = link.href satisfies the core functional requirements for this task. In src/scripts/main.js, within the .gallery click handler (around the middle of the file where you currently call e.preventDefault() at the top of the handler), consider moving e.preventDefault() to after you have confirmed that a valid link was found so that unrelated clicks inside .gallery are not unnecessarily blocked. Also in that same area of the file, it would be more robust to guard against missing DOM elements by checking that document.querySelector('.gallery') and document.querySelector('.gallery__img') both return non-null before you add listeners or update src. Outside the JS code, remember that the assignment expects you to replace the <your_account> placeholder in the demo link (e.g., in the README or project description) with your actual GitHub username so the published demo URL works for reviewers. These are minor improvements; the main behavior is solid and matches the task requirements well, so you can treat this as an opportunity to further polish already working code.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.