New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't select input text in Chrome #438
Comments
+1 for this. It's pretty annoying and I can't find a good way to fix it. |
Had this issue been fixed? |
Encountered the same problem here. |
I am also looking for a good solution to this. Here is a collection of issues that have been created for this, for reference:
Per @mondaychen, here is @gaearon's suggestion from #335: render() {
let element = (
<div>
<input
onMouseEnter={() => this.setState({ overInput: true }) }
onMouseLeave={() => this.setState({ overInput: false }) }
/>
</div>
);
if (this.state.overInput) {
return element;
}
return this.props.connectDragSource(element);
} The reason this doesn't work for me is that I have somewhat "unknown" children. The children are always forms but can be nested and used in other (non-draggable) situations. In my application, we could add @cscleison added this suggestion 11/11/16: class RowDraggable extends React.Component {
node = undefined;
constructor(props, ctx) {
super(props, ctx);
this.onHoverOverInput = this.onHoverOverInput.bind(this);
this.onHoverOutOfInput = this.onHoverOutOfInput.bind(this);
this.state = {overInput: false};
}
componentWillUnmount() {
this.detachEventListeners(this.node);
this.node = undefined;
}
getInputElements(node) {
return node
? Array.prototype.slice
.call(node.getElementsByTagName('input'))
.filter(e => !e.readOnly)
: [];
}
onHoverOverInput() {
this.setState({overInput: true});
}
onHoverOutOfInput() {
this.setState({overInput: false});
}
detachEventListeners(node) {
this.getInputElements(node).map(e => {
e.removeEventListener('mouseleave', this.onHoverOutOfInput);
e.removeEventListener('mouseenter', this.onHoverOverInput);
});
}
render() {
const { rowProps, isOver, connectDropTarget, connectDragSource
} = this.props;
const { overInput } = this.state;
return <YourRow
isOver={isOver}
ref={instance => {
this.detachEventListeners(this.node);
this.node = findDOMNode(instance);
if (!overInput) {
connectDragSource(this.node);
connectDropTarget(this.node);
this.getInputElements(this.node).map(e => {
e.addEventListener('mouseenter', this.onHoverOverInput);
});
} else {
this.getInputElements(this.node).map(e => {
e.addEventListener('mouseleave', this.onHoverOutOfInput);
});
}
}}
/>;
}
} This seems like my best option so far. It seems very hacky but like it would work. Any other ideas? |
Workaround mine with the use of Redux store instead of React state when my Similar to gaearon suggestion #335 but replace the state with Redux store. |
@tention yes, sounds like this might be best. I wish I didn't have to remind form makers to include these events on each input going forward, but probably not much else to do! |
my solution is: <input
onDragStart={(event) => {
event.stopPropagation();
event.preventDefault();
}}
draggable
/> |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
it works for me,great |
This is not documented very well, but if you add the class name No other solutions solved my issue.
|
I believe this is still an issue for
<input />
. See screen grab:#358 (comment)
The text was updated successfully, but these errors were encountered: