@@ -137,6 +137,16 @@ export function Timezone({ currentTime, timezone }) {
137
137
currentTime ,
138
138
)
139
139
140
+ function deleteTimezone ( ) {
141
+ actions . deleteTimezone ( timezone )
142
+ }
143
+
144
+ function deleteTimezoneOnKeyDown ( event ) {
145
+ if ( event . code === 'Enter' || event . code === 'Space' ) {
146
+ actions . deleteTimezone ( timezone )
147
+ }
148
+ }
149
+
140
150
useEffect ( ( ) => {
141
151
$ ( '.clockpicker-' + timezone . offset ) . clockpicker ( {
142
152
twelvehour : ! show24h ,
@@ -165,7 +175,7 @@ export function Timezone({ currentTime, timezone }) {
165
175
} }
166
176
className = "text-center px-2 focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary" >
167
177
< div className = { 'inline-block ' + 'clockpicker-' + timezone . offset } >
168
- < label htmlFor = { `time-${ timezone . offset } ` } className = "flex flex-wrap justify-center" >
178
+ < label htmlFor = { `time-${ timezone . offset } ` } className = "flex flex-wrap justify-center cursor-pointer " >
169
179
< span className = { showBoldHour ? 'font-semibold' : '' } > { hours } </ span >
170
180
< span > :</ span >
171
181
< span >
@@ -212,11 +222,13 @@ export function Timezone({ currentTime, timezone }) {
212
222
</ ul >
213
223
</ div >
214
224
215
- < div className = "absolute bottom-20 left-1/2 translate-x-[-50%] translate-y-[-20%] flex flex-col gap-4 invisible group-hover:visible" >
225
+ < div className = "absolute bottom-20 left-1/2 translate-x-[-50%] translate-y-[-20%] flex flex-col gap-4 invisible group-hover:visible group-focus-within:visible " >
216
226
< IconTrash
217
227
stroke = { 1.5 }
218
228
className = "cursor-pointer"
219
- onClick = { ( ) => actions . deleteTimezone ( timezone ) }
229
+ onClick = { deleteTimezone }
230
+ onKeyDown = { deleteTimezoneOnKeyDown }
231
+ tabIndex = { 0 }
220
232
title = "Delete timezone"
221
233
/>
222
234
</ div >
0 commit comments