@@ -101,17 +101,6 @@ function Table(props: TableProps) {
101
101
} ) ;
102
102
} , [ ] ) ;
103
103
104
- const handleKeyDown = useCallback (
105
- ( event : React . KeyboardEvent , direction : 'left' | 'right' ) => {
106
- // Support Enter and Space for activation (WCAG 2.1.1)
107
- if ( event . key === 'Enter' || event . key === ' ' ) {
108
- event . preventDefault ( ) ;
109
- handleScroll ( direction ) ;
110
- }
111
- } ,
112
- [ handleScroll ] ,
113
- ) ;
114
-
115
104
const scrollHandler = useDebouncedCallback ( checkScrollOverflow , 100 ) ;
116
105
117
106
useEffect ( ( ) => {
@@ -144,17 +133,15 @@ function Table(props: TableProps) {
144
133
{ scrollPosition === 'end' && 'Tabell ved slutt' }
145
134
</ div >
146
135
147
- < NavigationButton
136
+ < ScrollButton
148
137
direction = "left"
149
138
onClick = { ( ) => handleScroll ( 'left' ) }
150
- onKeyDown = { ( e ) => handleKeyDown ( e , 'left' ) }
151
139
canScroll = { canScrollLeft }
152
140
/>
153
141
154
- < NavigationButton
142
+ < ScrollButton
155
143
direction = "right"
156
144
onClick = { ( ) => handleScroll ( 'right' ) }
157
- onKeyDown = { ( e ) => handleKeyDown ( e , 'right' ) }
158
145
canScroll = { canScrollRight }
159
146
/>
160
147
@@ -174,52 +161,40 @@ function Table(props: TableProps) {
174
161
}
175
162
176
163
/**
177
- * Navigation button component for table scrolling
178
- * Supports keyboard interaction and proper WCAG compliance
164
+ * Scroll button component for table horizontal scrolling
165
+ * Simple div-based button for mouse interaction only
179
166
*/
180
- interface NavigationButtonProps {
167
+ interface ScrollButtonProps {
181
168
direction : 'left' | 'right' ;
182
169
onClick : ( ) => void ;
183
- onKeyDown : ( event : React . KeyboardEvent ) => void ;
184
170
canScroll : boolean ;
185
171
}
186
172
187
- function NavigationButton ( {
188
- direction,
189
- onClick,
190
- onKeyDown,
191
- canScroll,
192
- } : NavigationButtonProps ) {
173
+ function ScrollButton ( { direction, onClick, canScroll } : ScrollButtonProps ) {
193
174
const Icon = direction === 'left' ? ChevronLeft : ChevronRight ;
194
175
const position = direction === 'left' ? 'left-0' : 'right-0' ;
195
- const ariaLabel = `Scroll tabell ${ direction === 'left' ? 'til venstre' : 'til høyre' } ` ;
196
176
const bg =
197
177
direction === 'left'
198
178
? 'bg-[linear-gradient(90deg,white,white_calc(100%-10px),transparent)]'
199
179
: 'bg-[linear-gradient(90deg,transparent,white_calc(10px),white)]' ;
200
180
201
181
return (
202
- < button
203
- type = "button"
182
+ // biome-ignore lint/a11y/useKeyWithClickEvents: This button is only for mouse interaction to help users scroll. Keyboard and screen reader users can navigate the table content directly without needing these scroll helpers.
183
+ < div
204
184
onClick = { onClick }
205
- onKeyDown = { onKeyDown }
206
185
className = { cx (
207
186
'-translate-y-1/2 absolute top-5 z-10' ,
208
187
position ,
209
188
'flex h-11 w-11 items-center justify-center' ,
210
189
'cursor-pointer text-black transition-all duration-150 ease-out' ,
211
190
bg ,
212
191
'hover:bg-white' ,
213
- 'data-focus-visible:outline-focus-offset' ,
214
192
'motion-safe:transition-all motion-reduce:transition-none' ,
215
193
canScroll ? 'visible opacity-100' : 'invisible opacity-0' ,
216
194
) }
217
- aria-label = { ariaLabel }
218
- aria-hidden = { ! canScroll }
219
- tabIndex = { canScroll ? 0 : - 1 }
220
195
>
221
- < Icon className = "h-5 w-5" aria-hidden = "true" />
222
- </ button >
196
+ < Icon className = "h-5 w-5" />
197
+ </ div >
223
198
) ;
224
199
}
225
200
0 commit comments