File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
routes/(console)/organization-[organization]/wizard Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import { onMount } from ' svelte' ;
3
+
2
4
export let name: string ;
3
5
export let group: string ;
4
6
export let value: string | number | boolean ;
5
7
export let disabled = false ;
6
8
export let padding = 1 ;
9
+ export let autofocus = false ;
7
10
export let fullHeight = true ;
8
11
export let borderRadius: ' xsmall' | ' small' | ' medium' | ' large' = ' small' ;
9
12
13
16
medium = ' --border-radius-medium' ,
14
17
large = ' --border-radius-large'
15
18
}
19
+
20
+ let labelReference: HTMLLabelElement | null = null ;
21
+
22
+ onMount (() => {
23
+ if (autofocus ) {
24
+ labelReference ?.focus ();
25
+ }
26
+ });
16
27
</script >
17
28
18
29
<label
30
+ bind:this ={labelReference }
19
31
class =" box u-cursor-pointer u-flex u-flex-vertical u-gap-16"
20
32
class:is-allow-focus ={! disabled }
21
33
class:is-disabled ={disabled }
Original file line number Diff line number Diff line change 77
77
return 1 ;
78
78
}
79
79
return - 1 ;
80
- }) as region }
80
+ }) as region , index }
81
81
<li >
82
82
<RegionCard
83
83
name =" region"
84
84
bind:group ={$createProject .region }
85
85
value ={region .$id }
86
- disabled ={region .disabled }>
86
+ disabled ={region .disabled }
87
+ autofocus ={index === 0 }>
88
+ <!-- focus first item so enter key works! -->
87
89
<div
88
90
class =" u-flex u-flex-vertical u-gap-8 u-justify-main-center u-cross-center u-margin-inline-auto" >
89
91
{#if region .disabled }
You can’t perform that action at this time.
0 commit comments