@@ -25,18 +25,22 @@ import { useProjectActions } from "./project-hooks";
2525
2626interface SendButtonProps {
2727 size ?: ThemeTypings [ "components" ] [ "Button" ] [ "sizes" ] ;
28+ sendButtonRef : React . RefObject < HTMLButtonElement > ;
2829}
2930
3031const SendButton = React . forwardRef (
31- ( { size } : SendButtonProps , ref : ForwardedRef < HTMLButtonElement > ) => {
32+ (
33+ { size, sendButtonRef } : SendButtonProps ,
34+ ref : ForwardedRef < HTMLButtonElement >
35+ ) => {
3236 const status = useConnectionStatus ( ) ;
3337 const connected = status === ConnectionStatus . CONNECTED ;
3438 const actions = useProjectActions ( ) ;
3539 const handleToggleConnected = useCallback ( async ( ) => {
3640 if ( connected ) {
37- await actions . disconnect ( ) ;
41+ await actions . disconnect ( menuButtonRef ) ;
3842 } else {
39- await actions . connect ( false , ConnectionAction . CONNECT ) ;
43+ await actions . connect ( false , ConnectionAction . CONNECT , menuButtonRef ) ;
4044 }
4145 } , [ connected , actions ] ) ;
4246 const intl = useIntl ( ) ;
@@ -54,14 +58,14 @@ const SendButton = React.forwardRef(
5458 lastCompleteFlash : flashing . current . lastCompleteFlash ,
5559 } ;
5660 try {
57- await actions . flash ( ) ;
61+ await actions . flash ( sendButtonRef ) ;
5862 } finally {
5963 flashing . current = {
6064 flashing : false ,
6165 lastCompleteFlash : new Date ( ) . getTime ( ) ,
6266 } ;
6367 }
64- } , [ flashing , actions ] ) ;
68+ } , [ flashing , actions , sendButtonRef ] ) ;
6569 const handleFocus = useCallback (
6670 ( e ) => {
6771 const inProgress = flashing . current . flashing ;
@@ -74,6 +78,7 @@ const SendButton = React.forwardRef(
7478 } ,
7579 [ flashing ]
7680 ) ;
81+ const menuButtonRef = useRef < HTMLButtonElement > ( null ) ;
7782 return (
7883 < HStack >
7984 < Menu >
@@ -97,6 +102,7 @@ const SendButton = React.forwardRef(
97102 </ Button >
98103 </ Tooltip >
99104 < MoreMenuButton
105+ ref = { menuButtonRef }
100106 variant = "solid"
101107 aria-label = { intl . formatMessage ( { id : "more-connect-options" } ) }
102108 data-testid = "more-connect-options"
0 commit comments