File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/** @jsx React.DOM */
2+ /* global document:false */
23
34var React = require ( 'react' ) ;
45var classSet = require ( './utils/classSet' ) ;
@@ -110,9 +111,27 @@ var Modal = React.createClass({
110111 ) ;
111112 } ,
112113
114+ iosClickHack : function ( ) {
115+ // IOS only allows click events to be delegated to the document on elements
116+ // it considers 'clickable' - anchors, buttons, etc. We fake a click handler on the
117+ // DOM nodes themselves. Remove if handled by React: https://github.com/facebook/react/issues/1169
118+ this . refs . modal . getDOMNode ( ) . onclick = function ( ) { } ;
119+ this . refs . backdrop . getDOMNode ( ) . onclick = function ( ) { } ;
120+ } ,
121+
113122 componentDidMount : function ( ) {
114123 this . _onDocumentKeyupListener =
115124 EventListener . listen ( document , 'keyup' , this . handleDocumentKeyUp ) ;
125+
126+ if ( this . props . backdrop ) {
127+ this . iosClickHack ( ) ;
128+ }
129+ } ,
130+
131+ componentDidUpdate : function ( prevProps ) {
132+ if ( this . props . backdrop && this . props . backdrop !== prevProps . backdrop ) {
133+ this . iosClickHack ( ) ;
134+ }
116135 } ,
117136
118137 componentWillUnmount : function ( ) {
You can’t perform that action at this time.
0 commit comments