diff --git a/components/dialog/Dialog.jsx b/components/dialog/Dialog.jsx index ea415174..6cd57799 100644 --- a/components/dialog/Dialog.jsx +++ b/components/dialog/Dialog.jsx @@ -21,7 +21,7 @@ const Dialog = (props) => { onMouseDown={props.onOverlayMouseDown} onMouseUp={props.onOverlayMouseUp} onMouseMove={props.onOverlayMouseMove} - onEscKeyDown={props.onOverlayEscKeyDown} + onEscKeyDown={props.onEscKeyDown} >
@@ -41,8 +41,8 @@ Dialog.propTypes = { active: React.PropTypes.bool, children: React.PropTypes.node, className: React.PropTypes.string, + onEscKeyDown: React.PropTypes.func, onOverlayClick: React.PropTypes.func, - onOverlayEscKeyDown: React.PropTypes.func, onOverlayMouseDown: React.PropTypes.func, onOverlayMouseMove: React.PropTypes.func, onOverlayMouseUp: React.PropTypes.func, diff --git a/components/dialog/readme.md b/components/dialog/readme.md index 14283bd8..570e83ac 100644 --- a/components/dialog/readme.md +++ b/components/dialog/readme.md @@ -44,6 +44,6 @@ class DialogTest extends React.Component { | `onOverlayMouseDown` | `Function` | | Callback called when the mouse button is pressed on the overlay. | | `onOverlayMouseUp` | `Function` | | Callback called when the mouse button is released over the overlay. | | `onOverlayMouseMove` | `Function` | | Callback called when the mouse is moving over the overlay. | -| `onOverlayEscKeyDown` | `Function` | | Callback called when the ESC is pressed with the overlay active. | +| `onEscKeyDown` | `Function` | | Callback called when the ESC is pressed with the overlay active. | | `title` | `String` | | The text string to use as standar title of the dialog.| | `type` | `String` | `normal` | Used to determine the size of the dialog. It can be `small`, `normal` or `large`. | diff --git a/components/overlay/Overlay.jsx b/components/overlay/Overlay.jsx index 4e012b63..3856ce02 100644 --- a/components/overlay/Overlay.jsx +++ b/components/overlay/Overlay.jsx @@ -39,13 +39,13 @@ class Overlay extends React.Component { ReactDOM.unmountComponentAtNode(this.node); this.app.removeChild(this.node); if (this.escKeyListener) { - document.body.removeEventListener('keydown', this.handleEscKey) + document.body.removeEventListener('keydown', this.handleEscKey); this.escKeyListener = null; } } handleEscKey (e) { - if (this.props.active && this.props.onEscKeyDown && e.which == 27) { + if (this.props.active && this.props.onEscKeyDown && e.which === 27) { this.props.onEscKeyDown(e); } } diff --git a/spec/components/dialog.jsx b/spec/components/dialog.jsx index e70b811a..b9ac2c4c 100644 --- a/spec/components/dialog.jsx +++ b/spec/components/dialog.jsx @@ -30,7 +30,7 @@ class DialogTest extends React.Component { active={this.state.active} title="Use Google's location service?" onOverlayClick={this.handleToggle} - onOverlayEscKeyDown={this.handleToggle} + onEscKeyDown={this.handleToggle} >

Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.