Skip to content

Commit 8f7ecfb

Browse files
committed
fix: ProfileExplorer dropdown menu item onclicks don't fire
1 parent 568e9e4 commit 8f7ecfb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: plugins/plugin-codeflare/src/components/ProfileExplorer.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -297,18 +297,22 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
297297
/** Toggle kebab menu open/closed */
298298
private readonly _onKebabToggle = () => this.setState((curState) => ({ isKebabOpen: !curState.isKebabOpen }))
299299

300-
/** Set kebab menu closed */
301-
private readonly _onKebabClose = () => this.setState(() => ({ isKebabOpen: false }))
300+
/**
301+
* Set kebab menu closed; hmm, if we don't delay this, then the
302+
* DropdownItem onClicks don't fire. This seems like a patternfly
303+
* bug, that the onClicks of menu items are processed *after* the
304+
* onBlur of the menu dropdown...
305+
*/
306+
private readonly _onKebabClose = () => setTimeout(() => this.setState(() => ({ isKebabOpen: false })), 200)
302307

303308
private actions() {
304309
return (
305310
<React.Fragment>
306311
<Dropdown
307-
onBlur={this._onKebabClose}
308-
isOpen={this.state.isKebabOpen}
309312
isPlain
310313
position="right"
311-
toggle={<KebabToggle id="codeflare--profile-explorer-kebab" onToggle={this._onKebabToggle} />}
314+
isOpen={this.state.isKebabOpen}
315+
toggle={<KebabToggle onBlur={this._onKebabClose} onToggle={this._onKebabToggle} />}
312316
dropdownItems={this.actionItems}
313317
></Dropdown>
314318
</React.Fragment>

0 commit comments

Comments
 (0)