@@ -13,6 +13,7 @@ import { keys, matches } from '../../internal/keyboard';
1313import { AriaLabelPropType } from '../../prop-types/AriaPropTypes' ;
1414import { PrefixContext } from '../../internal/usePrefix' ;
1515import deprecate from '../../prop-types/deprecate' ;
16+ import { composeEventHandlers } from '../../tools/events' ;
1617
1718/**
1819 * `HeaderMenu` is used to render submenu's in the `Header`. Most often children
@@ -57,6 +58,24 @@ class HeaderMenu extends React.Component {
5758 */
5859 menuLinkName : PropTypes . string . isRequired ,
5960
61+ /**
62+ * Optionally provide an onBlur handler that is called when the underlying
63+ * button fires it's onblur event
64+ */
65+ onBlur : PropTypes . func ,
66+
67+ /**
68+ * Optionally provide an onClick handler that is called when the underlying
69+ * button fires it's onclick event
70+ */
71+ onClick : PropTypes . func ,
72+
73+ /**
74+ * Optionally provide an onKeyDown handler that is called when the underlying
75+ * button fires it's onkeydown event
76+ */
77+ onKeyDown : PropTypes . func ,
78+
6079 /**
6180 * Optional component to render instead of string
6281 */
@@ -190,6 +209,9 @@ class HeaderMenu extends React.Component {
190209 renderMenuContent : MenuContent ,
191210 menuLinkName,
192211 focusRef, // eslint-disable-line no-unused-vars
212+ onBlur,
213+ onClick,
214+ onKeyDown,
193215 ...rest
194216 } = this . props ;
195217
@@ -226,9 +248,9 @@ class HeaderMenu extends React.Component {
226248 < li // eslint-disable-line jsx-a11y/mouse-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions
227249 { ...rest }
228250 className = { itemClassName }
229- onKeyDown = { this . handleMenuClose }
230- onClick = { this . handleOnClick }
231- onBlur = { this . handleOnBlur } >
251+ onKeyDown = { composeEventHandlers ( [ onKeyDown , this . handleMenuClose ] ) }
252+ onClick = { composeEventHandlers ( [ onClick , this . handleOnClick ] ) }
253+ onBlur = { composeEventHandlers ( [ onBlur , this . handleOnBlur ] ) } >
232254 < a // eslint-disable-line jsx-a11y/role-supports-aria-props,jsx-a11y/anchor-is-valid
233255 aria-haspopup = "menu" // eslint-disable-line jsx-a11y/aria-proptypes
234256 aria-expanded = { this . state . expanded }
0 commit comments