Skip to content

Comments

style(web): command palette scrollbar visibility and styling#1093

Merged
tyler-dane merged 3 commits intomainfrom
copilot/fix-scrollbar-visibility-issue-2
Oct 10, 2025
Merged

style(web): command palette scrollbar visibility and styling#1093
tyler-dane merged 3 commits intomainfrom
copilot/fix-scrollbar-visibility-issue-2

Conversation

Copy link
Contributor

Copilot AI commented Oct 9, 2025

Fixes the command palette scrollbar not being visible when scrolling and ensures it uses the correct themed colors.

Problem

The command palette's scrollbar was:

  • ❌ Not visible when scrolling
  • ❌ Not using themed colors from the design system
  • ❌ Only appearing when hovering directly over the scrollbar area

This confused users who couldn't tell if there were more options below the visible area.

Solution

Added comprehensive scrollbar styling to the GlobalStyle component that targets react-cmdk's .overflow-y-auto scrollable container:

  • Hidden by default: Scrollbar thumb is transparent until interaction
  • Visible on palette hover: Shows when hovering anywhere inside the command palette
  • Visible during scrolling: Remains visible when actively scrolling
  • Themed colors: Uses theme.color.panel.scrollbar and theme.color.panel.scrollbarActive
  • Smooth transitions: 0.3s animation for showing/hiding

Implementation Details

The fix uses webkit scrollbar pseudo-selectors with multiple trigger states:

.command-palette .overflow-y-auto::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.command-palette:hover .overflow-y-auto::-webkit-scrollbar-thumb {
  background-color: ${theme.color.panel.scrollbar};
}

Screenshots

Screenshot 2025-10-09 at 10 53 04 PM

Closes #[issue-number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Scrollbar is not visible when scrolling</issue_title>
<issue_description>### Where did this happen?

Hosted (app.compasscalendar.com), Local code with an up-to-date main branch

Expected Behavior

  • Command palette's scrollbar is visible when scrolling
  • The scrollbar is not visible when not scrolling
  • When the user hovers over the scrollbar, the scrollbar is visible.
  • When the scrollbar is visible, it matches the existing color styles

Current Behavior

  • ❌ Command palette's scrollbar is visible when scrolling
  • ❌ The scrollbar is not visible when not scrolling
  • 👍 When the user hovers over the scrollbar, the scrollbar is visible.
  • ❌ When the scrollbar is visible, it matches the existing color styles
scrollbar-bug.mov

Steps to Reproduce

  1. Click cmd palette button or type cmd/windows+k
  2. Hover mouse over cmd menu and scroll
  3. Hover mouse over the cmd menu scrollbar and scroll

Possible Solution

Adjust styles

Context

This confuses users because they don't know whether there are more options below or not.

• Problem Context

  • The command palette uses react-cmdk, which renders an inner scrolling container with classes flex-1 overflow-y-auto.
  • Design requirements: scrollbar thumb must stay hidden until the user hovers anywhere inside the palette (no scroll prerequisite),
    then appear using the palette’s themed colors.
  • Existing code previously only changed the thumb color when the scrollable div itself received :hover/:focus, so first-time hover over
    surrounding palette failed to show it.

What I Tried

  • Added global CSS in GlobalStyle targeting .command-palette .flex-1.overflow-y-auto, defining CSS variables for the thumb color and
    custom WebKit scrollbar styles.
  • Added selectors for direct hover/focus and custom smooth transitions.
  • Attempted to cascade palette-level hover using descendant selectors and CSS variables.
  • Updated theme color token for better contrast.
  • Extended the test to assert new stylesheet rules are present (test still passes).
  • Reality check: despite CSS updates, real hover in browser still doesn’t activate the scrollbar first time because .command-palette is
    two layers up (HeadlessUI Dialog + inner div), and the React-CMDK structure likely stops the :hover cascade from reaching the scroll
    div until user interacts with it (scrolling scrollable area triggers internal scroll/active state causing custom gradient fallback
    to repaint).
    </issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1089


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: tyler-dane <30163055+tyler-dane@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix scrollbar visibility in command palette Fix command palette scrollbar visibility and styling Oct 9, 2025
Copilot AI requested a review from tyler-dane October 9, 2025 19:19
@tyler-dane tyler-dane marked this pull request as ready for review October 10, 2025 03:47
Copilot AI review requested due to automatic review settings October 10, 2025 03:47
Copy link
Contributor

Copilot AI left a 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 fixes the command palette scrollbar visibility and styling issues by adding comprehensive CSS styling to the GlobalStyle component. The scrollbar was previously invisible when scrolling and not using the correct themed colors.

  • Adds webkit scrollbar styling for the command palette's scrollable container
  • Implements proper hover and focus states to show/hide the scrollbar
  • Integrates themed colors from the design system

@tyler-dane tyler-dane force-pushed the copilot/fix-scrollbar-visibility-issue-2 branch from 94214a6 to ecef58b Compare October 10, 2025 03:56
@tyler-dane tyler-dane changed the title Fix command palette scrollbar visibility and styling style(web): command palette scrollbar visibility and styling Oct 10, 2025
@tyler-dane tyler-dane merged commit 532bde0 into main Oct 10, 2025
4 checks passed
@tyler-dane tyler-dane deleted the copilot/fix-scrollbar-visibility-issue-2 branch October 10, 2025 04:03
victor-enogwe pushed a commit that referenced this pull request Oct 24, 2025
* Initial plan

* Fix command palette scrollbar visibility and styling

Co-authored-by: tyler-dane <30163055+tyler-dane@users.noreply.github.com>

* style(web): remove redundant scrollbar styles

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tyler-dane <30163055+tyler-dane@users.noreply.github.com>
Co-authored-by: Tyler Dane <tyler@switchback.tech>
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.

Scrollbar is not visible when scrolling

2 participants