@@ -24,7 +24,13 @@ export function RecipientsLayout() {
2424 onBlur = { ( e ) => {
2525 const relatedTarget = e . relatedTarget
2626 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+ } )
2834 }
2935 } }
3036 onKeyDown = { ( e ) => {
@@ -38,45 +44,42 @@ export function RecipientsLayout() {
3844 </ summary >
3945 < 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" >
4046 { 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 : (
5874 < 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"
6578 />
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 >
7881 ) }
79- </ div >
82+ </ NavLink >
8083 ) ) }
8184 { recipients . length === 0 && (
8285 < div className = "bg-warning-background text-warning-foreground px-4 py-2 text-sm" >
0 commit comments