File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 5
5
import { Icon } from ' @sveltejs/site-kit/components' ;
6
6
import type { Snippet } from ' svelte' ;
7
7
8
- let { children }: { children: Snippet } = $props ();
8
+ let { children, label }: { children: Snippet ; label : string } = $props ();
9
9
10
10
let open = $state (false );
11
11
25
25
<details
26
26
class =" examples-select"
27
27
bind:open
28
+ ontogglecapture ={(e ) => {
29
+ const details = e .target as HTMLDetailsElement ;
30
+
31
+ if (details === e .currentTarget || ! details .open ) {
32
+ return ;
33
+ }
34
+
35
+ details .scrollIntoView ();
36
+ }}
28
37
ontoggle ={(e ) => {
29
38
const details = e .currentTarget ;
30
39
if (! details .open ) return ;
36
45
37
46
// except parents of the current one
38
47
const current = details .querySelector (` [href="${$page .url .pathname }"] ` );
48
+ if (! current ) return ;
39
49
40
50
let node = current as Element ;
41
51
44
54
(node as HTMLDetailsElement ).open = true ;
45
55
}
46
56
}
57
+
58
+ current .scrollIntoView ();
59
+ current .focus ();
47
60
}}
48
61
>
49
- <summary class =" raised icon" ><Icon name =" menu" /></summary >
62
+ <summary class ="raised icon" aria-label ={ label } ><Icon name =" menu" /></summary >
50
63
51
64
<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions (handled by <svelte:window>) -->
52
65
<div class ="modal-background" onclick ={() => (open = false )}></div >
Original file line number Diff line number Diff line change 181
181
<svelte:window on:keydown ={handleKeydown } />
182
182
183
183
<SecondaryNav >
184
- <SelectIcon
185
- bind:this ={select }
186
- title =" examples"
187
- value ={gist .id }
188
- onchange ={async (e ) => {
189
- goto (` /playground/${e .currentTarget .value } ` );
190
- }}
191
- >
184
+ <SelectIcon label =" Examples" >
192
185
<div class =" secondary-nav-dropdown" >
193
186
<a class =" create-new" href =" /playground/untitled" >Create new</a >
194
187
Original file line number Diff line number Diff line change 16
16
</script >
17
17
18
18
<SecondaryNav >
19
- <SelectIcon >
19
+ <SelectIcon label = " Menu " >
20
20
<div class =" secondary-nav-dropdown" >
21
21
{#each index as part }
22
22
<details >
You can’t perform that action at this time.
0 commit comments