Throws TypeError when trying to logWarnings on undefined host
mrfr0g opened this issue · 3 comments
I have a sortable component which defers to jQuery's UI sortable plugin. The plugin attaches itself to the DOM during the componentDidMount event. When an item is ordered I cancel the event (which restores the DOM order) and update the internal state of the component to match the new children render order. Its a similar solution to, http://stackoverflow.com/questions/29725136/jquery-ui-sortable-with-react-js-buggy.
When the setState method is called react-a11y attempts to hook into the rendered components and log warnings about the component, and ultimately fails because (I believe) the component is being reordered by React at the time. Effectively its failing at this step;
lib/index.js
121: if (includeSrcNode && component)
122: // Cannot log a node reference until the component is in the DOM,
123: // so defer the document.getElementById call until componentDidMount
124: // or componentDidUpdate.
125: logAfterRender(component._instance, warn);
component._instance is undefined in this case, so during the logAfterRender step its trying to access properties of an undefined object and throwing a TypeError.
+1
+1
I believe this issue may have been resolved in version v1.0.0. I'm going to close this but please re-open if it's still an issue.