File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
packages/compass-connections-navigation/src Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
- import React , { useState , useEffect } from 'react' ;
1
+ import React , {
2
+ useState ,
3
+ useEffect ,
4
+ forwardRef ,
5
+ type ButtonHTMLAttributes ,
6
+ } from 'react' ;
2
7
import {
3
8
css ,
4
9
Icon ,
@@ -17,18 +22,26 @@ const menuItemStyles = css({
17
22
type ConnectMenuItemProps = {
18
23
action : Actions ;
19
24
glyph : GlyphName ;
20
- } & Omit < MenuItemProps , 'glyph' > ;
25
+ } & Omit <
26
+ MenuItemProps & ButtonHTMLAttributes < HTMLButtonElement > ,
27
+ 'glyph' | 'as'
28
+ > ;
21
29
22
- function ConnectMenuItem ( { action, glyph, ...rest } : ConnectMenuItemProps ) {
30
+ export const ConnectMenuItem = forwardRef <
31
+ HTMLButtonElement ,
32
+ ConnectMenuItemProps
33
+ > ( function ConnectMenuItem ( { action, glyph, ...rest } , ref ) {
23
34
return (
24
35
< MenuItem
36
+ as = "button"
25
37
data-action = { action }
26
38
className = { menuItemStyles }
27
39
glyph = { < Icon glyph = { glyph } /> }
28
40
{ ...rest }
41
+ ref = { ref }
29
42
/>
30
43
) ;
31
- }
44
+ } ) ;
32
45
33
46
// Hack to make SplitButton consider this as a MenuItem
34
47
ConnectMenuItem . displayName = 'MenuItem' ;
You can’t perform that action at this time.
0 commit comments