Skip to content

Commit dd2e9b3

Browse files
committed
Style sidebar scrollbar and adjust focus
1 parent 1813205 commit dd2e9b3

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

src/App.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function App() {
188188
}, [handleGlobalDragEnter, handleGlobalDragOver, handleGlobalDragLeave, handleGlobalDrop]);
189189

190190
return (
191-
<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 relative page-fade-in">
191+
<div className="h-screen overflow-hidden bg-gradient-to-br from-blue-50 to-indigo-100 relative page-fade-in">
192192
{/* 全页面拖拽覆盖层 */}
193193
{globalDragOver && (
194194
<div
@@ -243,16 +243,16 @@ function App() {
243243
</button>
244244
)}
245245

246-
<div className="w-full px-3 py-3">
246+
<div className="w-full px-3 py-3 h-full">
247247

248248
<main
249249
id="main-content"
250-
className="grid grid-cols-1 xl:grid-cols-5 gap-3"
250+
className="grid grid-cols-1 xl:grid-cols-5 gap-3 h-full"
251251
role="main"
252252
>
253253
{sidebarVisible && (
254254
<aside
255-
className="xl:col-span-1 space-y-3 overflow-y-auto max-h-screen"
255+
className="xl:col-span-1 space-y-3 overflow-y-auto max-h-screen sidebar-scroll"
256256
role="complementary"
257257
aria-label="控制面板"
258258
>

src/components/CollapsibleSection.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function CollapsibleSection({ title, defaultOpen = true, action = null, c
99
<button
1010
type="button"
1111
onClick={() => setOpen(!open)}
12-
className="w-full flex items-center justify-between p-3 focus:outline-none"
12+
className="w-full flex items-center justify-between p-3"
1313
aria-expanded={open}
1414
>
1515
<h3 id={id} className="text-base font-semibold text-gray-800">

src/index.css

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919

2020
/* Focus styles for better keyboard navigation */
21-
:focus {
21+
:focus-visible {
2222
outline: 2px solid #3b82f6;
2323
outline-offset: 2px;
2424
}
@@ -130,11 +130,29 @@
130130
background-color: #dbeafe;
131131
}
132132

133+
/* Sidebar scrollbar styling */
134+
.sidebar-scroll {
135+
scrollbar-width: thin;
136+
}
137+
.sidebar-scroll::-webkit-scrollbar {
138+
width: 6px;
139+
}
140+
.sidebar-scroll::-webkit-scrollbar-track {
141+
background: transparent;
142+
}
143+
.sidebar-scroll::-webkit-scrollbar-thumb {
144+
background-color: #cbd5e1;
145+
border-radius: 3px;
146+
}
147+
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
148+
background-color: #94a3b8;
149+
}
150+
133151
/* Enhanced focus indicators for interactive elements */
134-
button:focus,
135-
input:focus,
136-
select:focus,
137-
textarea:focus {
152+
button:focus-visible,
153+
input:focus-visible,
154+
select:focus-visible,
155+
textarea:focus-visible {
138156
outline: 2px solid #3b82f6;
139157
outline-offset: 2px;
140158
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
@@ -162,8 +180,8 @@ button:disabled {
162180
}
163181

164182
/* Form improvements */
165-
input[type="radio"]:focus,
166-
input[type="checkbox"]:focus {
183+
input[type="radio"]:focus-visible,
184+
input[type="checkbox"]:focus-visible {
167185
outline: 2px solid #3b82f6;
168186
outline-offset: 2px;
169187
}

0 commit comments

Comments
 (0)