Skip to content

fix(landing): scrollbars hide when inactive#94

Merged
ian-pascoe merged 1 commit into
mainfrom
fix/landing-scrollbars
May 28, 2026
Merged

fix(landing): scrollbars hide when inactive#94
ian-pascoe merged 1 commit into
mainfrom
fix/landing-scrollbars

Conversation

@ian-pascoe
Copy link
Copy Markdown
Contributor

@ian-pascoe ian-pascoe commented May 28, 2026

This pull request enhances the visual behavior and accessibility of scrollbars on the landing page by introducing dynamic styling and interaction feedback. The main improvements include showing custom-styled scrollbars briefly during user interaction and updating the global CSS to support these visual changes.

Scrollbar interaction and behavior improvements:

  • Added a script to temporarily show custom-styled scrollbars when the user interacts with the page via scroll, wheel, touch, pointer, or specific keyboard events. The scrollbars become visible for a short period after interaction and then fade out. (apps/landing/src/pages/index.astro)

Styling and theming updates:

  • Introduced new CSS variables for scrollbar colors and states (default, active, hover) to support the dynamic scrollbar appearance. (apps/landing/src/styles/global.css)
  • Applied custom scrollbar styles using both standard and WebKit-specific selectors, including thin width, rounded corners, and color transitions based on interaction state. (apps/landing/src/styles/global.css)
  • Enabled the scrollbars-active class on the html element and certain panels to trigger the active scrollbar style, improving visibility during user interaction. (apps/landing/src/styles/global.css)

Summary by CodeRabbit

Release Notes

  • New Features
    • Scrollbars now briefly appear when users interact with the page through scrolling, mouse wheel, touch input, or keyboard navigation
    • Enhanced scrollbar visual styling with improved colors and appearance throughout the interface
    • Scrollbars become more prominent when hovering over them or when interactive panels are in focus

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR adds interactive scrollbar visibility to the landing page. CSS introduces new scrollbar design tokens for colors and styling rules (base appearance, active state, and WebKit specifics). JavaScript listens to user interactions (scroll, wheel, touch, pointer, keyboard) and briefly displays scrollbars by toggling a scrollbars-active class with a 900ms idle timeout.

Changes

Interactive Scrollbar Visibility

Layer / File(s) Summary
Scrollbar styling design tokens and rules
apps/landing/src/styles/global.css
New :root design tokens define scrollbar colors (thumb, active, hover, track). The universal * selector applies scrollbar width and base colors. Conditional rules apply active thumb color and WebKit scrollbar dimension/appearance styling.
Scrollbar visibility on user interaction
apps/landing/src/pages/index.astro
Event listeners on scroll, wheel, touchmove, pointerdown, and keyboard navigation keys call showScrollbarsBriefly(), which toggles the scrollbars-active class with an ~900ms idle timeout to reveal scrollbars during interaction.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops across the page,
And scrollbars dance with newfound rage,
They hide until the touch appears—
Then vanish after scrolling cheers,
Smooth lines and colors, timed so right,
Making interactions feel just right! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: introducing scrollbar visibility that hides when inactive, which is exactly what the PR implements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/landing-scrollbars

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Preview Deployed

Your changes have been deployed to a preview environment:

🌐 Landing Page: https://pr-94.preview.caplets.dev

Built from commit 6d15eb3


🤖 This comment updates automatically with each push.

@ian-pascoe ian-pascoe merged commit 202ec96 into main May 28, 2026
6 of 7 checks passed
@ian-pascoe ian-pascoe deleted the fix/landing-scrollbars branch May 28, 2026 18:54
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Greptile Summary

This PR adds auto-hiding scrollbar behaviour to the landing page: scrollbars are transparent by default, briefly become visible on any user interaction (scroll, wheel, touch, pointer, or navigation keys), and fade back out after 900 ms of inactivity. A companion CSS update introduces the required custom-property–driven theme and WebKit pseudo-element rules.

  • index.astro — adds five window event listeners that set/clear a debounced 900 ms timer toggling scrollbars-active on <html>, causing all scrollable areas to reveal their styled thumbs during interaction.
  • global.css — adds --scrollbar-thumb / --scrollbar-track CSS variables (default transparent), applies them globally via * scrollbar-color and ::-webkit-scrollbar-* pseudo-elements, and activates the non-transparent value under html.scrollbars-active or on hover/focus of .agent-setup-panel.

Confidence Score: 4/5

Safe to merge; the changes are self-contained UI polish with no data or logic risk.

The implementation is correct and behaves as intended. Two minor code-quality observations exist: the anonymous keydown handler has no stored reference (making future cleanup harder if View Transitions are added), and the CSS hover rule includes a redundant .agent-setup-panel pre selector that is never meaningfully exercised independently. Neither affects current behaviour.

No files require special attention; global.css has the redundant selector worth simplifying but nothing blocking.

Important Files Changed

Filename Overview
apps/landing/src/pages/index.astro Adds a JS debounce-based mechanism to temporarily reveal scrollbars on user interaction (scroll, wheel, touch, pointer, keyboard); logic is straightforward and correctly uses passive event listeners.
apps/landing/src/styles/global.css Introduces CSS variables for scrollbar theming and applies them via both the standard scrollbar-color (on *) and WebKit pseudo-elements; one redundant selector present in the hover/focus activation rule.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User Interaction] --> B{Event type?}
    B -->|scroll / wheel / touchmove| C[showScrollbarsBriefly]
    B -->|pointerdown| C
    B -->|keydown| D{Scroll key?}
    D -->|ArrowUp/Down, Home/End\nPageUp/Down, Space| C
    D -->|Other key| E[No-op]
    C --> F[Add 'scrollbars-active' to html]
    C --> G[clearTimeout previous timer]
    G --> H[setTimeout 900ms]
    H --> I[Remove 'scrollbars-active' from html]
    F --> J[CSS: --scrollbar-thumb = active color]
    I --> K[CSS: --scrollbar-thumb = transparent]
    J --> L[Scrollbars visible on all elements]
    K --> M[Scrollbars hidden]

    N[Hover .agent-setup-panel] --> O[CSS: --scrollbar-thumb = active on panel only]
    P[focus-within .agent-setup-panel] --> O
Loading

Fix All in Codex

Reviews (1): Last reviewed commit: "fix(landing): scrollbars hide when inact..." | Re-trigger Greptile

Comment on lines +54 to +58
html.scrollbars-active,
:where(.agent-setup-panel, .agent-setup-panel pre):hover,
:where(.agent-setup-panel, .agent-setup-panel pre):focus-within {
--scrollbar-thumb: var(--scrollbar-thumb-active);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Redundant :where(.agent-setup-panel pre) in hover/focus selector

In CSS, :hover on a child element propagates up the ancestor chain, so hovering .agent-setup-panel pre also triggers :hover on the parent .agent-setup-panel. The --scrollbar-thumb variable then inherits down to the pre, making the :where(.agent-setup-panel pre):hover and :where(.agent-setup-panel pre):focus-within selectors unreachable in any meaningful way that the .agent-setup-panel variants don't already cover. The rule could be simplified to just :where(.agent-setup-panel):hover and :where(.agent-setup-panel):focus-within.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex

Comment on lines +425 to +429
window.addEventListener("keydown", (event: KeyboardEvent) => {
if (["ArrowDown", "ArrowUp", "End", "Home", "PageDown", "PageUp", "Space"].includes(event.code)) {
showScrollbarsBriefly();
}
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Anonymous keydown handler cannot be removed

The anonymous arrow function passed to window.addEventListener("keydown", ...) has no stored reference, so it cannot be passed to removeEventListener later. The other four listeners all use the named showScrollbarsBriefly reference and can be cleaned up. If Astro View Transitions are ever added to this page, navigating back and forth would stack up duplicate keydown listeners on window, causing the scrollbar to re-appear multiple times per keypress. Extracting the arrow function into a named handler (or the same showScrollbarsBriefly with a guard, since all the listed keys trigger page scrolling anyway) would make cleanup straightforward.

Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant