diff --git a/CHANGELOG.md b/CHANGELOG.md index 15094a4e..2fcfb281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +v1.6.5 - Sat, 31 Dec 2016 17:14:28 GMT +-------------------------------------- + +- [c50f19a](../../commit/c50f19a) [fixed] Add file extention to entry point (#294) +- [08bf920](../../commit/08bf920) [fixed] closeTimeoutMS doesn't work without onRequestClose (#278) + + v1.6.4 - Thu, 15 Dec 2016 05:48:59 GMT -------------------------------------- diff --git a/bower.json b/bower.json index f4794464..23fc6129 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.6.4", + "version": "1.6.5", "homepage": "https://github.com/reactjs/react-modal", "authors": [ "Ryan Florence", diff --git a/dist/react-modal.js b/dist/react-modal.js index 588f47ee..8e0a51f0 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -356,7 +356,6 @@ return /******/ (function(modules) { // webpackBootstrap }, close: function close() { - if (!this.ownerHandlesClose()) return; if (this.props.closeTimeoutMS > 0) this.closeWithTimeout();else this.closeWithoutTimeout(); }, diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index 7baaba3b..65c87419 100644 --- a/dist/react-modal.min.js +++ b/dist/react-modal.min.js @@ -3,7 +3,7 @@ Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. */ -!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),s={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};o=function(){return s}.call(t,n,t,e),!(void 0!==o&&(e.exports=o))}()},function(e,t,n){"use strict";var o=n(2),r=o.DOM.div,s=n(6),i=n(8),u=n(9),a={overlay:{base:"ReactModal__Overlay",afterOpen:"ReactModal__Overlay--after-open",beforeClose:"ReactModal__Overlay--before-close"},content:{base:"ReactModal__Content",afterOpen:"ReactModal__Content--after-open",beforeClose:"ReactModal__Content--before-close"}};e.exports=o.createClass({displayName:"ModalPortal",shouldClose:null,getDefaultProps:function(){return{style:{overlay:{},content:{}}}},getInitialState:function(){return{afterOpen:!1,beforeClose:!1}},componentDidMount:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())},componentWillUnmount:function(){clearTimeout(this.closeTimer)},componentWillReceiveProps:function(e){!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()},componentDidUpdate:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))},setFocusAfterRender:function(e){this.focusAfterRender=e},open:function(){this.state.afterOpen&&this.state.beforeClose?(clearTimeout(this.closeTimer),this.setState({beforeClose:!1})):(s.setupScopedFocus(this.node),s.markForFocusLater(),this.setState({isOpen:!0},function(){this.setState({afterOpen:!0}),this.props.isOpen&&this.props.onAfterOpen&&this.props.onAfterOpen()}.bind(this)))},close:function(){this.ownerHandlesClose()&&(this.props.closeTimeoutMS>0?this.closeWithTimeout():this.closeWithoutTimeout())},focusContent:function(){this.contentHasFocus()||this.refs.content.focus()},closeWithTimeout:function(){this.setState({beforeClose:!0},function(){this.closeTimer=setTimeout(this.closeWithoutTimeout,this.props.closeTimeoutMS)}.bind(this))},closeWithoutTimeout:function(){this.setState({beforeClose:!1,isOpen:!1,afterOpen:!1},this.afterClose)},afterClose:function(){s.returnFocus(),s.teardownScopedFocus()},handleKeyDown:function(e){9==e.keyCode&&i(this.refs.content,e),27==e.keyCode&&(e.preventDefault(),this.requestClose(e))},handleOverlayMouseDown:function(e){null===this.shouldClose&&(this.shouldClose=!0)},handleOverlayMouseUp:function(e){this.shouldClose&&this.props.shouldCloseOnOverlayClick&&(this.ownerHandlesClose()?this.requestClose(e):this.focusContent()),this.shouldClose=null},handleContentMouseDown:function(e){this.shouldClose=!1},handleContentMouseUp:function(e){this.shouldClose=!1},requestClose:function(e){this.ownerHandlesClose()&&this.props.onRequestClose(e)},ownerHandlesClose:function(){return this.props.onRequestClose},shouldBeClosed:function(){return!this.props.isOpen&&!this.state.beforeClose},contentHasFocus:function(){return document.activeElement===this.refs.content||this.refs.content.contains(document.activeElement)},buildClassName:function(e,t){var n=a[e].base;return this.state.afterOpen&&(n+=" "+a[e].afterOpen),this.state.beforeClose&&(n+=" "+a[e].beforeClose),t?n+" "+t:n},render:function(){var e=this.props.className?{}:this.props.defaultStyles.content,t=this.props.overlayClassName?{}:this.props.defaultStyles.overlay;return this.shouldBeClosed()?r():r({ref:"overlay",className:this.buildClassName("overlay",this.props.overlayClassName),style:u({},t,this.props.style.overlay||{}),onMouseDown:this.handleOverlayMouseDown,onMouseUp:this.handleOverlayMouseUp},r({ref:"content",style:u({},e,this.props.style.content||{}),className:this.buildClassName("content",this.props.className),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentMouseDown,onMouseUp:this.handleContentMouseUp,role:this.props.role,"aria-label":this.props.contentLabel},this.props.children))}})},function(e,t,n){"use strict";function o(e){a=!0}function r(e){if(a){if(a=!1,!i)return;setTimeout(function(){if(!i.contains(document.activeElement)){var e=s(i)[0]||i;e.focus()}},0)}}var s=n(7),i=null,u=null,a=!1;t.markForFocusLater=function(){u=document.activeElement},t.returnFocus=function(){try{u.focus()}catch(e){console.warn("You tried to return focus to "+u+" but it is not in the DOM anymore")}u=null},t.setupScopedFocus=function(e){i=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))},t.teardownScopedFocus=function(){i=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}},function(e,t){"use strict";/*! +!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),s={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};o=function(){return s}.call(t,n,t,e),!(void 0!==o&&(e.exports=o))}()},function(e,t,n){"use strict";var o=n(2),r=o.DOM.div,s=n(6),i=n(8),u=n(9),a={overlay:{base:"ReactModal__Overlay",afterOpen:"ReactModal__Overlay--after-open",beforeClose:"ReactModal__Overlay--before-close"},content:{base:"ReactModal__Content",afterOpen:"ReactModal__Content--after-open",beforeClose:"ReactModal__Content--before-close"}};e.exports=o.createClass({displayName:"ModalPortal",shouldClose:null,getDefaultProps:function(){return{style:{overlay:{},content:{}}}},getInitialState:function(){return{afterOpen:!1,beforeClose:!1}},componentDidMount:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())},componentWillUnmount:function(){clearTimeout(this.closeTimer)},componentWillReceiveProps:function(e){!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()},componentDidUpdate:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))},setFocusAfterRender:function(e){this.focusAfterRender=e},open:function(){this.state.afterOpen&&this.state.beforeClose?(clearTimeout(this.closeTimer),this.setState({beforeClose:!1})):(s.setupScopedFocus(this.node),s.markForFocusLater(),this.setState({isOpen:!0},function(){this.setState({afterOpen:!0}),this.props.isOpen&&this.props.onAfterOpen&&this.props.onAfterOpen()}.bind(this)))},close:function(){this.props.closeTimeoutMS>0?this.closeWithTimeout():this.closeWithoutTimeout()},focusContent:function(){this.contentHasFocus()||this.refs.content.focus()},closeWithTimeout:function(){this.setState({beforeClose:!0},function(){this.closeTimer=setTimeout(this.closeWithoutTimeout,this.props.closeTimeoutMS)}.bind(this))},closeWithoutTimeout:function(){this.setState({beforeClose:!1,isOpen:!1,afterOpen:!1},this.afterClose)},afterClose:function(){s.returnFocus(),s.teardownScopedFocus()},handleKeyDown:function(e){9==e.keyCode&&i(this.refs.content,e),27==e.keyCode&&(e.preventDefault(),this.requestClose(e))},handleOverlayMouseDown:function(e){null===this.shouldClose&&(this.shouldClose=!0)},handleOverlayMouseUp:function(e){this.shouldClose&&this.props.shouldCloseOnOverlayClick&&(this.ownerHandlesClose()?this.requestClose(e):this.focusContent()),this.shouldClose=null},handleContentMouseDown:function(e){this.shouldClose=!1},handleContentMouseUp:function(e){this.shouldClose=!1},requestClose:function(e){this.ownerHandlesClose()&&this.props.onRequestClose(e)},ownerHandlesClose:function(){return this.props.onRequestClose},shouldBeClosed:function(){return!this.props.isOpen&&!this.state.beforeClose},contentHasFocus:function(){return document.activeElement===this.refs.content||this.refs.content.contains(document.activeElement)},buildClassName:function(e,t){var n=a[e].base;return this.state.afterOpen&&(n+=" "+a[e].afterOpen),this.state.beforeClose&&(n+=" "+a[e].beforeClose),t?n+" "+t:n},render:function(){var e=this.props.className?{}:this.props.defaultStyles.content,t=this.props.overlayClassName?{}:this.props.defaultStyles.overlay;return this.shouldBeClosed()?r():r({ref:"overlay",className:this.buildClassName("overlay",this.props.overlayClassName),style:u({},t,this.props.style.overlay||{}),onMouseDown:this.handleOverlayMouseDown,onMouseUp:this.handleOverlayMouseUp},r({ref:"content",style:u({},e,this.props.style.content||{}),className:this.buildClassName("content",this.props.className),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentMouseDown,onMouseUp:this.handleContentMouseUp,role:this.props.role,"aria-label":this.props.contentLabel},this.props.children))}})},function(e,t,n){"use strict";function o(e){a=!0}function r(e){if(a){if(a=!1,!i)return;setTimeout(function(){if(!i.contains(document.activeElement)){var e=s(i)[0]||i;e.focus()}},0)}}var s=n(7),i=null,u=null,a=!1;t.markForFocusLater=function(){u=document.activeElement},t.returnFocus=function(){try{u.focus()}catch(e){console.warn("You tried to return focus to "+u+" but it is not in the DOM anymore")}u=null},t.setupScopedFocus=function(e){i=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))},t.teardownScopedFocus=function(){i=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}},function(e,t){"use strict";/*! * Adapted from jQuery UI core * * http://jqueryui.com diff --git a/package.json b/package.json index 80016586..25f0b685 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.6.4", + "version": "1.6.5", "description": "Accessible modal dialog component for React.JS", "main": "./lib/index.js", "repository": { @@ -75,4 +75,4 @@ "modal", "dialog" ] -} +} \ No newline at end of file