Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
khlutkova committed Feb 2, 2022
1 parent f75c08e commit 82464c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/react-ui/components/MenuItem/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export class MenuItem extends React.Component<MenuItemProps> {
className={className}
tabIndex={-1}
ref={this.commonRef}
onClick={this.onClick}
>
{iconElement}
{content}
Expand All @@ -211,6 +212,11 @@ export class MenuItem extends React.Component<MenuItemProps> {
return this.commonRef.current;
};

private onClick = (e: React.MouseEvent<HTMLElement>) => {
this.props.onClick?.(e);
this.context.onClick?.(this._key);
};

// https://github.com/facebook/react/issues/10109
// Mouseenter event not triggered when cursor moves from disabled button
private handleMouseEnterFix = (e: React.MouseEvent<HTMLElement>) => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-ui/internal/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export class Menu extends React.Component<MenuProps, MenuState> {
setHighlightedKey: this.highlight,
highlightedKey: this.state.highlightedKey,
_enableIconPadding: this.state._enableIconPadding,
onClick: this.select.bind(this),
}}
>
{this.props.children}
Expand Down

0 comments on commit 82464c3

Please sign in to comment.