Don't let click events propagate out of context menus
This commit is contained in:
parent
5eaf0e7e25
commit
898e4acb4f
1 changed files with 6 additions and 0 deletions
|
@ -226,6 +226,11 @@ export class ContextMenu extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onClick = (ev: React.MouseEvent) => {
|
||||||
|
// Don't allow clicks to escape the context menu wrapper
|
||||||
|
ev.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
private onKeyDown = (ev: React.KeyboardEvent) => {
|
private onKeyDown = (ev: React.KeyboardEvent) => {
|
||||||
// don't let keyboard handling escape the context menu
|
// don't let keyboard handling escape the context menu
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
@ -383,6 +388,7 @@ export class ContextMenu extends React.PureComponent<IProps, IState> {
|
||||||
className={classNames("mx_ContextualMenu_wrapper", this.props.wrapperClassName)}
|
className={classNames("mx_ContextualMenu_wrapper", this.props.wrapperClassName)}
|
||||||
style={{ ...position, ...wrapperStyle }}
|
style={{ ...position, ...wrapperStyle }}
|
||||||
onKeyDown={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
|
onClick={this.onClick}
|
||||||
onContextMenu={this.onContextMenuPreventBubbling}
|
onContextMenu={this.onContextMenuPreventBubbling}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in a new issue