@@ -75,7 +75,7 @@ It appears when the user clicks on the `Search` component or presses the corresp
75
75
last_scroll_position = null ;
76
76
document .body .style .position = ' ' ;
77
77
document .body .tabIndex = - 1 ;
78
- document .body . focus ();
78
+ ( document .activeElement as HTMLElement )?. blur ();
79
79
document .body .removeAttribute (' tabindex' );
80
80
window .scrollTo (0 , scroll );
81
81
@@ -167,31 +167,37 @@ It appears when the user clicks on the `Search` component or presses the corresp
167
167
use:trap
168
168
>
169
169
<div class =" search-box" >
170
- <div style =" background: var(--background); padding: 0.5rem" >
171
- <input
172
- use:forcefocus
173
- onkeydown ={(e ) => {
170
+ <div class =" controls" >
171
+ <div class =" input-group" >
172
+ <input
173
+ use:forcefocus
174
+ onkeydown ={(e ) => {
174
175
if (e .key === ' Enter' && ! e .isComposing ) {
175
176
const element = modal .querySelector (' a[data-has-node]' ) as HTMLElement | undefined ;
176
177
element ?.click ();
177
178
}
178
179
}}
179
- oninput ={(e ) => {
180
- $search_query = e .currentTarget .value ;
181
- }}
182
- value ={$search_query }
183
- {placeholder }
184
- aria-describedby =" search-description"
185
- aria-label ={placeholder }
186
- spellcheck =" false"
187
- />
180
+ oninput ={(e ) => {
181
+ $search_query = e .currentTarget .value ;
182
+ }}
183
+ value ={$search_query }
184
+ {placeholder }
185
+ aria-describedby =" search-description"
186
+ aria-label ={placeholder }
187
+ spellcheck =" false"
188
+ />
189
+
190
+ <button aria-label ="Clear" onclick ={() => ($search_query = ' ' )}>
191
+ <Icon name =" close" />
192
+ </button >
193
+ </div >
194
+
195
+ <button class ="raised" aria-label ="Close" onclick ={close }>
196
+ <!-- <Icon name="close" /> -->
197
+ <kbd >Esc</kbd >
198
+ </button >
188
199
</div >
189
200
190
- <button aria-label ="Close" onclick ={close }>
191
- <!-- <Icon name="close" /> -->
192
- <kbd >Esc</kbd >
193
- </button >
194
-
195
201
<span id =" search-description" class =" visually-hidden" >
196
202
{#if search_description }
197
203
{@render search_description ()}
@@ -230,14 +236,15 @@ It appears when the user clicks on the `Search` component or presses the corresp
230
236
</a >
231
237
232
238
<button
239
+ class =" raised icon"
233
240
aria-label =" Delete"
234
241
onclick ={(e ) => {
235
242
$search_recent = $search_recent .filter ((href ) => href !== search .href );
236
243
e .stopPropagation ();
237
244
e .preventDefault ();
238
245
}}
239
246
>
240
- <Icon name =" delete" />
247
+ <Icon name ="delete" size ={ 16 } />
241
248
</button >
242
249
</li >
243
250
{/each }
@@ -310,50 +317,85 @@ It appears when the user clicks on the `Search` component or presses the corresp
310
317
}
311
318
}
312
319
313
- input {
314
- font : var (--sk-font-ui-large );
315
- width : 100% ;
316
- padding : calc (var (--padding ) - 0.5rem ) 5rem calc (var (--padding ) - 0.5rem ) var (--padding );
317
- height : 6rem ;
318
- border : none ;
319
- border-bottom : 1px solid var (--sk-back-3 );
320
- flex-shrink : 0 ;
321
- background : var (--sk-back-3 );
322
- color : var (--sk-text-1 );
323
-
324
- &::selection {
325
- background-color: var (--sk-back-translucent );
326
- }
320
+ .controls {
321
+ background : var (--background );
322
+ padding : 0.5rem ;
323
+ display : flex ;
324
+ gap : 1rem ;
325
+ }
327
326
328
- &::placeholder {
329
- color : var (--sk-text-2 );
330
- opacity : 0.3 ;
327
+ .input-group {
328
+ position : relative ;
329
+ flex : 1 ;
330
+
331
+ input {
332
+ font : var (--sk-font-ui-large );
333
+ width : 100% ;
334
+ padding : var (--padding ) 6rem var (--padding ) calc (var (--padding ) - 0.5rem );
335
+ height : 6rem ;
336
+ border : none ;
337
+ flex-shrink : 0 ;
338
+ color : var (--sk-text-1 );
339
+ border-bottom : 1px solid var (--sk-back-6 );
340
+ background : inherit ;
341
+
342
+ &::selection {
343
+ background-color: var (--sk-back-translucent );
344
+ }
345
+
346
+ &::placeholder {
347
+ color : var (--sk-text-2 );
348
+ opacity : 0.3 ;
349
+ }
350
+
351
+ &:focus-visible {
352
+ outline-offset : -2px ;
353
+ }
331
354
}
332
355
333
- &:focus-visible {
334
- outline-offset : -3px ;
356
+ button {
357
+ position : absolute ;
358
+ right : 0 ;
359
+ top : 0 ;
360
+ height : 100% ;
361
+ aspect-ratio : 1 ;
362
+ color : var (--sk-text-4 );
363
+
364
+ &:hover,
365
+ &:focus {
366
+ color : var (--sk-text-3 );
367
+ }
368
+
369
+ &:focus-visible {
370
+ outline-offset : -2px ;
371
+ }
335
372
}
336
373
}
337
374
338
375
button [aria-label = ' Close' ] {
339
- --size : 2rem ;
340
- position : absolute ;
341
- top : 0.5rem ;
342
- right : 0 ;
343
- width : 5rem ;
344
- height : 6rem ;
376
+ height : 100% ;
377
+ aspect-ratio : 1 ;
345
378
background : none ;
346
- color : var (--sk-text-2 );
347
- opacity : 0.3 ;
379
+
380
+ &:hover,
381
+ &:focus {
382
+ color : var (--sk-text-3 );
383
+ }
348
384
349
385
&:focus-visible {
350
- opacity: 1 ;
351
- outline-offset : -3px ;
386
+ outline-offset : -2px ;
352
387
}
353
388
354
389
kbd {
390
+ display : flex ;
391
+ align-items : center ;
392
+ justify-content : center ;
355
393
text-transform : uppercase ;
356
- font : var (--sk-font-ui-small );
394
+ background : none ;
395
+ font : var (--sk-font-ui-medium );
396
+ color : var (--sk-text-4 );
397
+ width : 100% ;
398
+ height : 100% ;
357
399
}
358
400
}
359
401
@@ -373,38 +415,40 @@ It appears when the user clicks on the `Search` component or presses the corresp
373
415
374
416
li {
375
417
position : relative ;
418
+ display : flex ;
419
+ padding : 0.2rem var (--padding );
420
+ gap : 1rem ;
421
+
422
+ &:hover {
423
+ background : var (--sk-back-3 );
424
+ }
376
425
377
426
a {
378
427
color : var (--sk-text-2 );
379
428
display : block ;
380
429
text-decoration : none ;
381
- padding : 0.5rem calc (4rem + var (--padding )) 0.5rem var (--padding );
382
-
383
- &:hover {
384
- background : rgba (0 , 0 , 0 , 0.05 );
385
- }
430
+ margin : 0 -0.5rem ;
431
+ padding : 0.5rem ;
432
+ flex : 1 ;
386
433
387
434
&:focus {
388
435
outline-offset: -3px ;
389
436
}
390
437
}
391
438
392
439
button [aria-label = ' Delete' ] {
393
- position : absolute ;
394
- top : 0 ;
395
- right : 0 ;
396
- width : 5rem ;
397
- height : 100% ;
398
- color : var (--sk-text-2 );
399
- opacity : 0.1 ;
440
+ width : 3.2rem ;
441
+ height : 3.2rem ;
442
+ color : var (--sk-text-4 );
443
+ background-color : var (--sk-back-2 );
400
444
401
445
&:hover {
402
- opacity: 1 ;
403
446
outline: none ;
447
+ color : var (--sk-text-3 );
404
448
}
405
449
406
450
&:focus-visible {
407
- opacity : 1 ;
451
+ color : var ( --sk-text-3 ) ;
408
452
outline-offset : -3px ;
409
453
}
410
454
}
0 commit comments