Skip to content

Commit 4749496

Browse files
authored
Merge branch 'develop' into hs/remove-allowVoipWithNoMedia
2 parents 5da5c61 + 8376e43 commit 4749496

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/components/views/messages/MessageActionBar.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
8080
onFocusChange,
8181
getRelationsForEvent,
8282
}) => {
83-
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
84-
const [onFocus, isActive] = useRovingTabIndex(button);
83+
const [onFocus, isActive, buttonRefCallback, buttonRef] = useRovingTabIndex();
84+
const [menuDisplayed, , openMenu, closeMenu] = useContextMenu(buttonRef);
8585
useEffect(() => {
8686
onFocusChange(menuDisplayed);
8787
}, [onFocusChange, menuDisplayed]);
@@ -101,11 +101,11 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
101101
);
102102

103103
let contextMenu: ReactElement | undefined;
104-
if (menuDisplayed && button.current) {
104+
if (menuDisplayed && buttonRef.current) {
105105
const tile = getTile?.();
106106
const replyChain = getReplyChain();
107107

108-
const buttonRect = button.current.getBoundingClientRect();
108+
const buttonRect = buttonRef.current.getBoundingClientRect();
109109
contextMenu = (
110110
<MessageContextMenu
111111
{...aboveLeftOf(buttonRect)}
@@ -127,7 +127,7 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
127127
onClick={onOptionsClick}
128128
onContextMenu={onOptionsClick}
129129
isExpanded={menuDisplayed}
130-
ref={button}
130+
ref={buttonRefCallback}
131131
onFocus={onFocus}
132132
tabIndex={isActive ? 0 : -1}
133133
placement="left"
@@ -146,15 +146,15 @@ interface IReactButtonProps {
146146
}
147147

148148
const ReactButton: React.FC<IReactButtonProps> = ({ mxEvent, reactions, onFocusChange }) => {
149-
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
150-
const [onFocus, isActive] = useRovingTabIndex(button);
149+
const [onFocus, isActive, buttonRefCallback, buttonRef] = useRovingTabIndex();
150+
const [menuDisplayed, , openMenu, closeMenu] = useContextMenu(buttonRef);
151151
useEffect(() => {
152152
onFocusChange(menuDisplayed);
153153
}, [onFocusChange, menuDisplayed]);
154154

155155
let contextMenu: JSX.Element | undefined;
156-
if (menuDisplayed && button.current) {
157-
const buttonRect = button.current.getBoundingClientRect();
156+
if (menuDisplayed && buttonRef.current) {
157+
const buttonRect = buttonRef.current.getBoundingClientRect();
158158
contextMenu = (
159159
<ContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu} managed={false}>
160160
<ReactionPicker mxEvent={mxEvent} reactions={reactions} onFinished={closeMenu} />
@@ -185,7 +185,7 @@ const ReactButton: React.FC<IReactButtonProps> = ({ mxEvent, reactions, onFocusC
185185
onClick={onClick}
186186
onContextMenu={onClick}
187187
isExpanded={menuDisplayed}
188-
ref={button}
188+
ref={buttonRefCallback}
189189
onFocus={onFocus}
190190
tabIndex={isActive ? 0 : -1}
191191
placement="left"

0 commit comments

Comments
 (0)