@@ -24,7 +24,13 @@ export function RecipientsLayout() {
24
24
onBlur = { ( e ) => {
25
25
const relatedTarget = e . relatedTarget
26
26
if ( ! e . currentTarget . contains ( relatedTarget ) ) {
27
- e . currentTarget . removeAttribute ( 'open' )
27
+ const el = e . currentTarget
28
+ // seems to cause the browser to crash if relatedTarget is null
29
+ // (like clicking within the details, but not on anything in particular)
30
+ // so we wrap it in a requestAnimationFrame and it closes fine.
31
+ requestAnimationFrame ( ( ) => {
32
+ el . removeAttribute ( 'open' )
33
+ } )
28
34
}
29
35
} }
30
36
onKeyDown = { ( e ) => {
@@ -38,45 +44,42 @@ export function RecipientsLayout() {
38
44
</ summary >
39
45
< div className = "bg-background-alt absolute top-full left-0 z-10 mt-1 max-w-full min-w-64 border p-2 shadow-lg" >
40
46
{ recipients . map ( ( recipient ) => (
41
- < div key = { recipient . id } className = "flex items-center gap-2" >
42
- < NavLink
43
- to = { recipient . id }
44
- className = { ( { isActive } ) =>
45
- clsx (
46
- 'overflow-x-auto text-xl' ,
47
- isActive ? 'underline' : '' ,
48
- )
49
- }
50
- onClick = { ( e ) => {
51
- e . currentTarget
52
- . closest ( 'details' )
53
- ?. removeAttribute ( 'open' )
54
- } }
55
- >
56
- { ( { isActive } ) => (
57
- < div className = "flex items-center gap-1" >
47
+ < NavLink
48
+ key = { recipient . id }
49
+ to = { recipient . id }
50
+ className = { ( { isActive } ) =>
51
+ clsx (
52
+ 'hover:bg-background flex items-center gap-2 overflow-x-auto text-xl' ,
53
+ isActive ? 'underline' : '' ,
54
+ )
55
+ }
56
+ onClick = { ( e ) => {
57
+ e . currentTarget . closest ( 'details' ) ?. removeAttribute ( 'open' )
58
+ } }
59
+ >
60
+ { ( { isActive } ) => (
61
+ < div className = "flex items-center gap-1" >
62
+ < Icon
63
+ name = "ArrowRight"
64
+ size = "sm"
65
+ className = { clsx (
66
+ isActive ? 'opacity-100' : 'opacity-0' ,
67
+ 'transition-opacity' ,
68
+ ) }
69
+ />
70
+ { recipient . name }
71
+ { recipient . messages . some (
72
+ ( m ) => m . status === 'scheduled' ,
73
+ ) ? null : (
58
74
< Icon
59
- name = "ArrowRight"
60
- size = "sm"
61
- className = { clsx (
62
- isActive ? 'opacity-100' : 'opacity-0' ,
63
- 'transition-opacity' ,
64
- ) }
75
+ name = "ExclamationCircle"
76
+ className = "text-danger-foreground"
77
+ title = "no messages scheduled"
65
78
/>
66
- { recipient . name }
67
- </ div >
68
- ) }
69
- </ NavLink >
70
- { recipient . messages . some (
71
- ( m ) => m . status === 'scheduled' ,
72
- ) ? null : (
73
- < Icon
74
- name = "ExclamationCircle"
75
- className = "text-danger-foreground"
76
- title = "no messages scheduled"
77
- />
79
+ ) }
80
+ </ div >
78
81
) }
79
- </ div >
82
+ </ NavLink >
80
83
) ) }
81
84
{ recipients . length === 0 && (
82
85
< div className = "bg-warning-background text-warning-foreground px-4 py-2 text-sm" >
0 commit comments