As you can see with the gif below, trello's list titles are input boxes that get focused onclick, but don't get focused on if you long click. How can this functionality be implemented? I am using react, so no jquery, but vanilla js is fine, thanks
Asked
Active
Viewed 104 times
1 Answers
0
It's long press
class App extends Component {
constructor() {
super()
this.handleButtonPress = this.handleButtonPress.bind(this)
this.handleButtonRelease = this.handleButtonRelease.bind(this)
}
handleButtonPress () {
this.buttonPressTimer = setTimeout(() => alert('long press activated'), 1500);
}
handleButtonRelease () {
clearTimeout(this.buttonPressTimer);
}
render() {
return (
<div
onTouchStart={this.handleButtonPress}
onTouchEnd={this.handleButtonRelease}
onMouseDown={this.handleButtonPress}
onMouseUp={this.handleButtonRelease}
onMouseLeave={this.handleButtonRelease}>
Button
</div>
);
}
}
Original: react long press event

Pavel Petrovich
- 734
- 10
- 9