Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 8fa1c2b

Browse files
RiotRobott3chguy
andauthored
[Backport staging] Fix usages of useContextMenu which never pass the ref to the element (#9450)
Co-authored-by: Michael Telatynski <[email protected]>
1 parent 450ddbe commit 8fa1c2b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/views/messages/MessageActionBar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
8383
getRelationsForEvent,
8484
}) => {
8585
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
86-
const [onFocus, isActive, ref] = useRovingTabIndex(button);
86+
const [onFocus, isActive] = useRovingTabIndex(button);
8787
useEffect(() => {
8888
onFocusChange(menuDisplayed);
8989
}, [onFocusChange, menuDisplayed]);
@@ -123,7 +123,7 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
123123
onClick={onOptionsClick}
124124
onContextMenu={onOptionsClick}
125125
isExpanded={menuDisplayed}
126-
inputRef={ref}
126+
inputRef={button}
127127
onFocus={onFocus}
128128
tabIndex={isActive ? 0 : -1}
129129
>
@@ -141,7 +141,7 @@ interface IReactButtonProps {
141141

142142
const ReactButton: React.FC<IReactButtonProps> = ({ mxEvent, reactions, onFocusChange }) => {
143143
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
144-
const [onFocus, isActive, ref] = useRovingTabIndex(button);
144+
const [onFocus, isActive] = useRovingTabIndex(button);
145145
useEffect(() => {
146146
onFocusChange(menuDisplayed);
147147
}, [onFocusChange, menuDisplayed]);
@@ -173,7 +173,7 @@ const ReactButton: React.FC<IReactButtonProps> = ({ mxEvent, reactions, onFocusC
173173
onClick={onClick}
174174
onContextMenu={onClick}
175175
isExpanded={menuDisplayed}
176-
inputRef={ref}
176+
inputRef={button}
177177
onFocus={onFocus}
178178
tabIndex={isActive ? 0 : -1}
179179
>

src/components/views/rooms/MessageComposerButtons.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ const EmojiButton: React.FC<IEmojiButtonProps> = ({ addEmoji, menuPosition }) =>
179179
iconClassName="mx_MessageComposer_emoji"
180180
onClick={openMenu}
181181
title={_t("Emoji")}
182+
inputRef={button}
182183
/>
183184

184185
{ contextMenu }

0 commit comments

Comments
 (0)