From 211d42998b7aaea823678585e3c03ac142447e24 Mon Sep 17 00:00:00 2001 From: vzvu3k6k Date: Sun, 4 Dec 2016 19:58:58 +0900 Subject: [PATCH] Don't toggle QuestionCard when you select text --- pages/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/index.js b/pages/index.js index 268a657d0..c0b3fbf17 100644 --- a/pages/index.js +++ b/pages/index.js @@ -6,11 +6,18 @@ class QuestionCard extends React.Component { constructor(...args) { super(...args); this.state = { hidden: true }; + this.handleClick = this.handleClick.bind(this); + } + + handleClick(event) { + if (!window.getSelection || window.getSelection().isCollapsed) { + this.setState({ hidden: !this.state.hidden }); + } } render() { return( -
{ this.setState({ hidden: !this.state.hidden }) }}> +
Q. {this.props.question}