-
Notifications
You must be signed in to change notification settings - Fork 4
🚸 Add nav arrows in carousel modal #655
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
Conversation
williamchong
commented
Feb 1, 2026
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
This PR adds navigation arrows to the carousel modal, allowing users to navigate between carousel items directly from the modal view without closing it.
Changes:
- Replaced direct modal item ref with index-based tracking for navigation support
- Added left/right chevron navigation buttons to the modal with semi-transparent styling
- Implemented circular navigation logic that wraps around at carousel boundaries
| <UButton | ||
| icon="i-material-symbols-chevron-left" | ||
| color="neutral" | ||
| variant="ghost" | ||
| class="absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer" | ||
| @click="navigateModal(-1)" | ||
| /> | ||
| <UButton | ||
| icon="i-material-symbols-chevron-right" | ||
| color="neutral" | ||
| variant="ghost" | ||
| class="absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer" | ||
| @click="navigateModal(1)" | ||
| /> |
Copilot
AI
Feb 1, 2026
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 navigation arrows are always displayed, even when there's only one item in the carousel. The carousel itself only renders when carouselItems.length > 1 (line 3), but the modal with navigation arrows will still appear when clicking on a single BookCover (the else branch starting at line 115). The buttons should be conditionally rendered based on whether there are multiple items to navigate through.
| <UButton | ||
| icon="i-material-symbols-chevron-left" | ||
| color="neutral" | ||
| variant="ghost" | ||
| class="absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer" | ||
| @click="navigateModal(-1)" | ||
| /> | ||
| <UButton | ||
| icon="i-material-symbols-chevron-right" | ||
| color="neutral" | ||
| variant="ghost" | ||
| class="absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer" | ||
| @click="navigateModal(1)" | ||
| /> |
Copilot
AI
Feb 1, 2026
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 navigation buttons lack accessible labels for screen readers. Icon-only buttons should include aria-label attributes to describe their purpose for users relying on assistive technology. Add aria-label="Previous" to the left button and aria-label="Next" to the right button (or use appropriate internationalized strings).
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
components/BookCoverCarousel.vue
Outdated
| :alt="props.alt" | ||
| class="w-full h-auto max-h-[80vh] object-contain" | ||
| > | ||
| <div class="relative"> |
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.
why not add relative to content slot
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
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| function navigateModal(direction: number) { | ||
| const len = carouselItems.value.length | ||
| modalItemIndex.value = (modalItemIndex.value + direction + len) % len | ||
| } |
Copilot
AI
Feb 2, 2026
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.
Consider adding keyboard navigation support (ArrowLeft/ArrowRight keys) for improved accessibility and user experience. The PDFReader component (components/PDFReader.vue:571-593) implements keyboard navigation using event listeners. This would allow users to navigate through carousel items using keyboard shortcuts in addition to clicking the arrow buttons.
| class="absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer" | ||
| @click="navigateModal(-1)" | ||
| /> | ||
| <UButton | ||
| icon="i-material-symbols-chevron-right" | ||
| color="neutral" | ||
| variant="ghost" | ||
| aria-label="Next" | ||
| class="absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer" | ||
| @click="navigateModal(1)" | ||
| /> |
Copilot
AI
Feb 2, 2026
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 cursor-pointer class is redundant for UButton components as buttons already have pointer cursor by default. This is a minor styling nit and doesn't affect functionality.