Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
fix(contextmenu): Fix #1722 TopSites context menu not clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
sarracini authored and ncloudioj committed Nov 8, 2016
1 parent 2728d9d commit 17d58da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions content-src/components/ContextMenu/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ const ContextMenu = React.createClass({
componentWillMount() {
this.hideContext = () => {
this.props.onUpdate(false);
window.removeEventListener("click", this.hideContext);
};
},
componentWillUnmount() {
window.removeEventListener("click", this.hideContext);
},
componentDidUpdate(prevProps) {
if (this.props.visible && !prevProps.visible) {
setTimeout(() => {
window.addEventListener("click", this.hideContext, false);
}, 0);
}
if (!this.props.visible && prevProps.visible) {
window.removeEventListener("click", this.hideContext);
}
},
render() {
return (<span hidden={!this.props.visible} className="context-menu">
Expand Down
1 change: 1 addition & 0 deletions content-src/components/LinkMenuButton/LinkMenuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const LinkMenuButton = React.createClass({
render() {
return (<button className="link-menu-button" onClick={e => {
e.preventDefault();
e.stopPropagation();
this.props.onClick(e);
}}>
<span className="sr-only">Open context menu</span>
Expand Down

0 comments on commit 17d58da

Please sign in to comment.