-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add interactive reveal button for code overlay and improve UI responsiveness #261
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
jumski
commented
Oct 16, 2025
- Implemented a button to toggle display of lengthy code snippets with smooth animations
- Added styles for overlay, button, and responsive behavior, including reduced motion support
- Enhanced user experience by hiding scroll indicator when overlay is active
- Updated event handling to manage overlay visibility and animations effectively
- Included media queries for mobile and reduced motion preferences
- Minor code adjustments for better maintainability and visual consistency
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
View your CI Pipeline Execution ↗ for commit 4c0d969
☁️ Nx Cloud last updated this comment at |
c849765 to
425ae84
Compare
425ae84 to
738c8b2
Compare
738c8b2 to
18f7a6d
Compare
| const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; | ||
| // 1. Fade out overlay and start scrolling immediately | ||
| overlay.style.opacity = '0'; | ||
| scrollable.classList.add('scrollable-enabled'); | ||
| // Start scroll animation while overlay fades | ||
| const scrollPromise = smoothScroll(scrollable, scrollable.scrollHeight, 2500); |
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 prefersReducedMotion check is correctly positioned before animation starts, but the code still initiates smoothScroll regardless of preference. Consider restructuring to avoid creating the animation promise entirely when reduced motion is preferred:
// Check if user prefers reduced motion
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
// 1. Fade out overlay and enable scrolling
overlay.style.opacity = '0';
scrollable.classList.add('scrollable-enabled');
// Handle different animation paths based on motion preference
if (prefersReducedMotion) {
// Skip animation entirely for reduced motion
await wait(300);
overlay.classList.add('hidden');
// Show buttons immediately
showControlButtons();
} else {
// Start scroll animation while overlay fades
const scrollPromise = smoothScroll(scrollable, scrollable.scrollHeight, 2500);
await wait(300);
overlay.classList.add('hidden');
await scrollPromise;
showControlButtons();
}This approach respects user preferences more completely by avoiding unnecessary animation setup.
| const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; | |
| // 1. Fade out overlay and start scrolling immediately | |
| overlay.style.opacity = '0'; | |
| scrollable.classList.add('scrollable-enabled'); | |
| // Start scroll animation while overlay fades | |
| const scrollPromise = smoothScroll(scrollable, scrollable.scrollHeight, 2500); | |
| const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; | |
| // 1. Fade out overlay and enable scrolling | |
| overlay.style.opacity = '0'; | |
| scrollable.classList.add('scrollable-enabled'); | |
| // Handle different animation paths based on motion preference | |
| if (prefersReducedMotion) { | |
| // Skip animation entirely for reduced motion | |
| await wait(300); | |
| overlay.classList.add('hidden'); | |
| // Show buttons immediately | |
| showControlButtons(); | |
| } else { | |
| // Start scroll animation while overlay fades | |
| const scrollPromise = smoothScroll(scrollable, scrollable.scrollHeight, 2500); | |
| await wait(300); | |
| overlay.classList.add('hidden'); | |
| await scrollPromise; | |
| showControlButtons(); | |
| } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
18f7a6d to
f5ce922
Compare
f5ce922 to
68c89d1
Compare
| .reset-overlay-button { | ||
| display: none !important; | ||
| } | ||
|
|
||
| .scroll-top-button { | ||
| display: none !important; | ||
| } |
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 CSS selectors for .reset-overlay-button and .scroll-top-button in the mobile media query are missing the :global() wrapper that's used consistently elsewhere in the file. Without this wrapper, these styles won't correctly target the elements in the Astro component.
For consistency and to ensure proper styling in mobile view, these selectors should be updated to:
:global(.reset-overlay-button) {
display: none !important;
}
:global(.scroll-top-button) {
display: none !important;
}This matches the pattern used for these same elements in other parts of the stylesheet.
| .reset-overlay-button { | |
| display: none !important; | |
| } | |
| .scroll-top-button { | |
| display: none !important; | |
| } | |
| :global(.reset-overlay-button) { | |
| display: none !important; | |
| } | |
| :global(.scroll-top-button) { | |
| display: none !important; | |
| } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
18ec9ab to
450c4f1
Compare
68c89d1 to
0ea7402
Compare
…esponsiveness - Implemented a button to toggle display of lengthy code snippets with smooth animations - Added styles for overlay, button, and responsive behavior, including reduced motion support - Enhanced user experience by hiding scroll indicator when overlay is active - Updated event handling to manage overlay visibility and animations effectively - Included media queries for mobile and reduced motion preferences - Minor code adjustments for better maintainability and visual consistency
0ea7402 to
4c0d969
Compare
🔍 Preview Deployment: Website✅ Deployment successful! 🔗 Preview URL: https://pr-261.pgflow.pages.dev 📝 Details:
_Last updated: _ |
🔍 Preview Deployment: Playground✅ Deployment successful! 🔗 Preview URL: https://pr-261--pgflow-demo.netlify.app 📝 Details:
_Last updated: _ |
Merge activity
|
…esponsiveness (#261) - Implemented a button to toggle display of lengthy code snippets with smooth animations - Added styles for overlay, button, and responsive behavior, including reduced motion support - Enhanced user experience by hiding scroll indicator when overlay is active - Updated event handling to manage overlay visibility and animations effectively - Included media queries for mobile and reduced motion preferences - Minor code adjustments for better maintainability and visual consistency
