This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
src/components/views/messages Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,17 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
7676 onFocusChange ( menuDisplayed ) ;
7777 } , [ onFocusChange , menuDisplayed ] ) ;
7878
79+ const onOptionsClick = ( e : React . MouseEvent ) : void => {
80+ // Don't open the regular browser or our context menu on right-click
81+ e . preventDefault ( ) ;
82+ e . stopPropagation ( ) ;
83+ openMenu ( ) ;
84+ // when the context menu is opened directly, e.g. via mouse click, the onFocus handler which tracks
85+ // the element that is currently focused is skipped. So we want to call onFocus manually to keep the
86+ // position in the page even when someone is clicking around.
87+ onFocus ( ) ;
88+ } ;
89+
7990 let contextMenu : ReactElement | null ;
8091 if ( menuDisplayed ) {
8192 const tile = getTile && getTile ( ) ;
@@ -97,13 +108,7 @@ const OptionsButton: React.FC<IOptionsButtonProps> = ({
97108 < ContextMenuTooltipButton
98109 className = "mx_MessageActionBar_maskButton mx_MessageActionBar_optionsButton"
99110 title = { _t ( "Options" ) }
100- onClick = { ( ) => {
101- openMenu ( ) ;
102- // when the context menu is opened directly, e.g. via mouse click, the onFocus handler which tracks
103- // the element that is currently focused is skipped. So we want to call onFocus manually to keep the
104- // position in the page even when someone is clicking around.
105- onFocus ( ) ;
106- } }
111+ onClick = { onOptionsClick }
107112 isExpanded = { menuDisplayed }
108113 inputRef = { ref }
109114 onFocus = { onFocus }
You can’t perform that action at this time.
0 commit comments