@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- import React , { RefObject , useCallback , useEffect } from "react" ;
17
+ import React , { useCallback , useEffect } from "react" ;
18
18
import { MatrixEvent } from "matrix-js-sdk/src" ;
19
19
20
20
import { ButtonEvent } from "../elements/AccessibleButton" ;
@@ -27,7 +27,6 @@ import { _t } from "../../../languageHandler";
27
27
import IconizedContextMenu , { IconizedContextMenuOption , IconizedContextMenuOptionList } from "./IconizedContextMenu" ;
28
28
import { WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore" ;
29
29
import { MatrixClientPeg } from "../../../MatrixClientPeg" ;
30
- import { useRovingTabIndex } from "../../../accessibility/RovingTabIndex" ;
31
30
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload" ;
32
31
33
32
interface IProps {
@@ -36,13 +35,6 @@ interface IProps {
36
35
onMenuToggle ?: ( open : boolean ) => void ;
37
36
}
38
37
39
- interface IExtendedProps extends IProps {
40
- // Props for making the button into a roving one
41
- tabIndex ?: number ;
42
- inputRef ?: RefObject < HTMLElement > ;
43
- onFocus ?( ) : void ;
44
- }
45
-
46
38
const contextMenuBelow = ( elementRect : DOMRect ) => {
47
39
// align the context menu's icons with the icon which opened the context menu
48
40
const left = elementRect . left + window . pageXOffset + elementRect . width ;
@@ -51,27 +43,13 @@ const contextMenuBelow = (elementRect: DOMRect) => {
51
43
return { left, top, chevronFace } ;
52
44
} ;
53
45
54
- export const RovingThreadListContextMenu : React . FC < IProps > = ( props ) => {
55
- const [ onFocus , isActive , ref ] = useRovingTabIndex ( ) ;
56
-
57
- return < ThreadListContextMenu
58
- { ...props }
59
- onFocus = { onFocus }
60
- tabIndex = { isActive ? 0 : - 1 }
61
- inputRef = { ref }
62
- /> ;
63
- } ;
64
-
65
- const ThreadListContextMenu : React . FC < IExtendedProps > = ( {
46
+ const ThreadListContextMenu : React . FC < IProps > = ( {
66
47
mxEvent,
67
48
permalinkCreator,
68
49
onMenuToggle,
69
- onFocus,
70
- inputRef,
71
50
...props
72
51
} ) => {
73
- const [ menuDisplayed , _ref , openMenu , closeThreadOptions ] = useContextMenu ( ) ;
74
- const button = inputRef ?? _ref ; // prefer the ref we receive via props in case we are being controlled
52
+ const [ menuDisplayed , button , openMenu , closeThreadOptions ] = useContextMenu ( ) ;
75
53
76
54
const viewInRoom = useCallback ( ( evt : ButtonEvent ) : void => {
77
55
evt . preventDefault ( ) ;
@@ -95,11 +73,8 @@ const ThreadListContextMenu: React.FC<IExtendedProps> = ({
95
73
} , [ mxEvent , closeThreadOptions , permalinkCreator ] ) ;
96
74
97
75
useEffect ( ( ) => {
98
- if ( onMenuToggle ) {
99
- onMenuToggle ( menuDisplayed ) ;
100
- }
101
- onFocus ?.( ) ;
102
- } , [ menuDisplayed , onMenuToggle , onFocus ] ) ;
76
+ onMenuToggle ?.( menuDisplayed ) ;
77
+ } , [ menuDisplayed , onMenuToggle ] ) ;
103
78
104
79
const isMainSplitTimelineShown = ! WidgetLayoutStore . instance . hasMaximisedWidget (
105
80
MatrixClientPeg . get ( ) . getRoom ( mxEvent . getRoomId ( ) ) ,
0 commit comments