We created a React project that uses Material-ui to display dialog boxes. For some reason, when you press a button that launches a dialog to open, a second touch event appears that could potentially trigger a link or button located in a dialog box. A similar problem occurs when you close the dialog box by clicking on the button. In this case, the dialog closes, but causes another touch event for the element that is located immediately after the element that you clicked on.
We have enabled react-tap-event-plugin to use Material-ui, and the application works very well if there are no two elements that overlap this ghost crane behavior.
This is a simplified version of what our component looks like:
import React, { Component } from 'react' import Dialog from 'material-ui/Dialog' class Introduction extends Component { constructor(props) { super(props) this.state = { complete: false } this.finish = this.finish.bind(this) } finish() { this.setState({ complete: true }) } render() { const actions = ( <div> <button onTouchTap={this.finish}>Finish</button> </div> ) if (!this.state.complete) { return ( <Dialog open actions={actions}> <h3>Dialog header</h3> <p>Dialog text</p> </Dialog> ) } return null } }
This, when this βDoneβ action button is clicked, closes the dialog and then the element behind it also receives the touchTap event.
If that matters, we use Cordova to port the application to mobile. We encounter this problem only on mobile devices (specifically on iOS), but also on device mode when testing in Chrome.
What am I doing wrong? Any advice would be appreciated.
source share