diff --git a/src/ModalTrigger.js b/src/ModalTrigger.js index facb1414a1..bc227b1f39 100644 --- a/src/ModalTrigger.js +++ b/src/ModalTrigger.js @@ -54,6 +54,8 @@ const ModalTrigger = React.createClass({ props.onClick = createChainedFunction(child.props.onClick, this.toggle); props.onMouseOver = createChainedFunction(child.props.onMouseOver, this.props.onMouseOver); props.onMouseOut = createChainedFunction(child.props.onMouseOut, this.props.onMouseOut); + props.onFocus = createChainedFunction(child.props.onFocus, this.props.onFocus); + props.onBlur = createChainedFunction(child.props.onBlur, this.props.onBlur); return cloneElement(child, props); } diff --git a/test/ModalTriggerSpec.js b/test/ModalTriggerSpec.js index 1f90db52fd..020a8aac1a 100644 --- a/test/ModalTriggerSpec.js +++ b/test/ModalTriggerSpec.js @@ -42,4 +42,34 @@ describe('ModalTrigger', function() { ReactTestUtils.Simulate.mouseOut(modalTrigger); assert.equal(called, true); }); + + it('Should pass ModalTrigger onFocus prop to children', function() { + let called = false; + let callback = function() { + called = true; + }; + let instance = ReactTestUtils.renderIntoDocument( + test} onFocus={callback}> + + + ); + let modalTrigger = instance.getDOMNode(); + ReactTestUtils.Simulate.focus(modalTrigger); + assert.equal(called, true); + }); + + it('Should pass ModalTrigger onBlur prop to children', function() { + let called = false; + let callback = function() { + called = true; + }; + let instance = ReactTestUtils.renderIntoDocument( + test} onBlur={callback}> + + + ); + let modalTrigger = instance.getDOMNode(); + ReactTestUtils.Simulate.blur(modalTrigger); + assert.equal(called, true); + }); });