diff --git a/src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js b/src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js index 5b30244cc648d9..fb467dd886751d 100644 --- a/src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js +++ b/src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js @@ -158,10 +158,14 @@ function isInteractive(tag) { function shouldPreventMouseEvent(inst) { if (inst) { - var disabled = inst._currentElement && inst._currentElement.props.disabled; + var focus = inst; - if (disabled) { - return isInteractive(inst._tag); + while (focus) { + if (focus._currentElement && focus._currentElement.props.disabled) { + return isInteractive(focus._tag); + } + + focus = focus._hostParent; } } diff --git a/src/renderers/dom/client/eventPlugins/__tests__/SimpleEventPlugin-test.js b/src/renderers/dom/client/eventPlugins/__tests__/SimpleEventPlugin-test.js index d8f30633d10bbf..6cea83723d8e81 100644 --- a/src/renderers/dom/client/eventPlugins/__tests__/SimpleEventPlugin-test.js +++ b/src/renderers/dom/client/eventPlugins/__tests__/SimpleEventPlugin-test.js @@ -58,6 +58,17 @@ describe('SimpleEventPlugin', function() { expect(onClick.mock.calls.length).toBe(1); }); + it('clicking a child of a disabled element does not register a click', function() { + var element = ReactTestUtils.renderIntoDocument( + + ); + var child = ReactDOM.findDOMNode(element).querySelector('span'); + + onClick.mockClear(); + ReactTestUtils.SimulateNative.click(child); + expect(onClick.mock.calls.length).toBe(0); + }); + ['button', 'input', 'select', 'textarea'].forEach(function(tagName) { describe(tagName, function() {