-
Notifications
You must be signed in to change notification settings - Fork 185
Image-Search-app #351
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
Image-Search-app #351
Conversation
|
@Techy-ninja is attempting to deploy a commit to the Suman Kunwar's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull Request Overview
Adds a new example Image Search application demonstrating Unsplash API integration, async JS patterns, and a responsive UI.
- Introduces HTML/CSS/JS implementation for searching and displaying images with infinite scroll and modal viewing.
- Provides a README documenting features, setup, and code concepts.
- Includes UI styling and interactive behaviors (loading states, error handling, modal display).
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| examples/Image-Search-App/index.html | Base markup for search UI, results grid, loading/error states, and load-more controls. |
| examples/Image-Search-App/style.css | Styles for layout, grid, buttons, modal, and responsive adjustments. |
| examples/Image-Search-App/script.js | Core application logic: search, pagination, infinite scroll, modal handling, error states. |
| examples/Image-Search-App/README.md | Documentation of features, setup, code patterns, and usage. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| this.loadMoreButton.innerHTML = ` | ||
| <div class="load-more-spinner hidden"></div> | ||
| `; |
Copilot
AI
Oct 14, 2025
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.
After an error the button remains disabled (set earlier in showLoadMoreLoadingState) and the timeout replaces its content with only a hidden spinner, removing the actionable label and never re-enabling the button, preventing retry. Re-enable the button and restore the normal 'Load More Images' label (and spinner structure) so users can attempt again.
| this.loadMoreButton.innerHTML = ` | |
| <div class="load-more-spinner hidden"></div> | |
| `; | |
| this.hideLoadMoreLoadingState(); |
| // Animate new images | ||
| setTimeout(() => { | ||
| const imageItems = this.imageGrid.querySelectorAll('.image-item'); | ||
| imageItems.forEach((item, index) => { | ||
| item.style.opacity = '1'; | ||
| item.style.transform = 'translateY(0)'; | ||
| item.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; | ||
| }); |
Copilot
AI
Oct 14, 2025
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.
[nitpick] Per-item inline transition setup duplicates the global animation rules added later (lines 358-361). Consolidate animation/transition logic in CSS to avoid divergence and simplify future adjustments.
| style.textContent = ` | ||
| .image-item { animation: fadeInUp 0.6s ease forwards; } | ||
| @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } | ||
| `; |
Copilot
AI
Oct 14, 2025
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.
[nitpick] This global animation definition overlaps with the manual opacity/transform/transition handling elsewhere (e.g., lines 159-166 and initial inline styles in createImageElement). Unifying to a single CSS-driven approach will reduce redundancy.
| <input | ||
| type="text" | ||
| id="searchInput" | ||
| placeholder="Search for images... (e.g., nature, technology, animals)" | ||
| class="search-input" | ||
| autocomplete="off" | ||
| > |
Copilot
AI
Oct 14, 2025
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.
Input lacks an associated or an aria-label / aria-labelledby attribute; relying solely on placeholder impairs accessibility. Add a visible label or aria-label (e.g., <label for="searchInput">Search images) to improve screen reader support.
| <button id="loadMoreButton" class="load-more-button"> | ||
| <div class="load-more-spinner"></div> | ||
| Load More Images | ||
| </button> |
Copilot
AI
Oct 14, 2025
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.
The decorative spinner inside the button lacks aria-hidden and the button does not convey loading state via aria-busy or disabled contextually. Mark the spinner <div class="load-more-spinner" aria-hidden="true"> and toggle aria-busy / aria-live or provide status text for assistive technologies.
| <button id="loadMoreButton" class="load-more-button"> | |
| <div class="load-more-spinner"></div> | |
| Load More Images | |
| </button> | |
| <button id="loadMoreButton" class="load-more-button" aria-busy="false"> | |
| <div class="load-more-spinner" aria-hidden="true"></div> | |
| Load More Images | |
| </button> | |
| <span id="loadMoreStatus" class="visually-hidden" aria-live="polite"></span> |
| <div class="modal-overlay"> | ||
| <div class="modal-content"> | ||
| <button class="modal-close" aria-label="Close">×</button> | ||
| <img src="${this.escapeHtml(imageUrl)}" alt="${this.escapeHtml(description)}" class="modal-image"> | ||
| <div class="modal-info"> | ||
| <p class="modal-description">${this.escapeHtml(description)}</p> | ||
| <p class="modal-author">Photo by ${this.escapeHtml(authorName)}</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| `; | ||
|
|
Copilot
AI
Oct 14, 2025
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.
Modal creation does not manage focus (no initial focus on close button or content, no focus trap, and original focus is not restored on close). Add focus trapping (keydown Tab handling), set initial focus (e.g., close button), and restore previous focus after removing the modal.
| - **Responsive Design**: Mobile-first approach with media queries | ||
|
|
||
| ## 📁 Project Structure | ||
|
|
Copilot
AI
Oct 14, 2025
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.
Filename listed as styles.css but the actual file added is style.css; update the README to match the real filename to avoid confusion.
| } | ||
| ``` | ||
|
|
||
| ### Responsive CSS Grid |
Copilot
AI
Oct 14, 2025
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.
Documentation shows minmax(280px, 1fr) and gap: 2rem, but the implemented CSS (style.css lines 56-59) uses minmax(240px, 1fr) and gap: var(--gap) (1.5rem). Align the README example with the actual code or note the difference intentionally.
| ✅ **Full-size Image Modal**: Click any image for larger view | ||
| ✅ **Keyboard Navigation**: Enter to search, Escape to close modal | ||
| ✅ **Smooth Animations**: Fade-in effects and hover states | ||
| ✅ **Accessibility**: Proper focus states and ARIA attributes |
Copilot
AI
Oct 14, 2025
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.
Claim of 'Proper focus states and ARIA attributes' is not fully reflected in the current implementation (e.g., missing label for search input, no focus trap or restored focus in modal). Update the claim or implement the missing accessibility enhancements.
| ✅ **Accessibility**: Proper focus states and ARIA attributes | |
| ✅ **Accessibility**: Some focus states and ARIA attributes; further enhancements (e.g., search input label, modal focus trap) pending |
sumn2u
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.
LGTM!
|
|
||
| class ImageSearchApp { | ||
| constructor() { | ||
| this.API_KEY = 'YOUR_UNSPLASH_ACCESS_KEY'; // Unsplash Access Key (replace if necessary) |
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.
Nice work on commenting the access key.
Issue #320
Added an Image Search App in example folder.
Here's the preview for this:
image-search.mp4