File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed
Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,37 @@ export const GlobalStyle = createGlobalStyle`
2121 :focus-visible {
2222 outline: none;
2323 }
24+
25+ /* Command Palette Scrollbar Styling */
26+ .command-palette .overflow-y-auto {
27+ /* Always reserve scrollbar space */
28+ scrollbar-width: auto;
29+
30+ /* Webkit scrollbar styling (Chrome, Safari, Edge) */
31+ &::-webkit-scrollbar {
32+ width: 8px;
33+ }
34+
35+ /* Hide the scrollbar thumb by default (transparent) */
36+ &::-webkit-scrollbar-thumb {
37+ background-color: transparent;
38+ border-radius: ${ ( { theme } ) => theme . shape . borderRadius } ;
39+ transition: background-color 0.3s ease;
40+ }
41+
42+ /* On hover of the container, make the scrollbar thumb visible */
43+ &:hover::-webkit-scrollbar-thumb {
44+ background-color: ${ ( { theme } ) => theme . color . panel . scrollbar } ;
45+ }
46+
47+ /* On hover of the thumb itself, make it more visible */
48+ &:hover::-webkit-scrollbar-thumb:hover {
49+ background-color: ${ ( { theme } ) => theme . color . panel . scrollbarActive } ;
50+ }
51+
52+ /* Show scrollbar during active scrolling */
53+ &.scrolling::-webkit-scrollbar-thumb {
54+ background-color: ${ ( { theme } ) => theme . color . panel . scrollbar } ;
55+ }
56+ }
2457` ;
Original file line number Diff line number Diff line change @@ -53,6 +53,47 @@ const CmdPalette = ({
5353 setOpen ( _open ) ;
5454 } , [ _open ] ) ;
5555
56+ // Handle scrollbar visibility during scrolling
57+ useEffect ( ( ) => {
58+ if ( ! open ) return ;
59+
60+ const handleScroll = ( ) => {
61+ const scrollableElement = document . querySelector (
62+ ".command-palette .overflow-y-auto" ,
63+ ) ;
64+ if ( scrollableElement ) {
65+ scrollableElement . classList . add ( "scrolling" ) ;
66+
67+ // Clear any existing timeout
68+ const existingTimeout = ( scrollableElement as any ) . scrollTimeout ;
69+ if ( existingTimeout ) {
70+ clearTimeout ( existingTimeout ) ;
71+ }
72+
73+ // Remove the scrolling class after scrolling stops
74+ ( scrollableElement as any ) . scrollTimeout = setTimeout ( ( ) => {
75+ scrollableElement . classList . remove ( "scrolling" ) ;
76+ } , 150 ) ;
77+ }
78+ } ;
79+
80+ const scrollableElement = document . querySelector (
81+ ".command-palette .overflow-y-auto" ,
82+ ) ;
83+
84+ if ( scrollableElement ) {
85+ scrollableElement . addEventListener ( "scroll" , handleScroll ) ;
86+
87+ return ( ) => {
88+ scrollableElement . removeEventListener ( "scroll" , handleScroll ) ;
89+ const timeout = ( scrollableElement as any ) . scrollTimeout ;
90+ if ( timeout ) {
91+ clearTimeout ( timeout ) ;
92+ }
93+ } ;
94+ }
95+ } , [ open ] ) ;
96+
5697 useHandleOpenCommandPalette ( setOpen ) ;
5798
5899 const handleCreateSomedayDraft = async (
You can’t perform that action at this time.
0 commit comments