reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

Uncaught TypeError: Cannot read property 'ownerDocument' of null #256

Closed tmonte closed 7 years ago

tmonte commented 7 years ago

This issue is still happening, if you go to https://reactcommunity.org/react-autocomplete/custom-menu/ and type a letter and erase it repeatedly you can see the multiple errors on the console.

CMTegner commented 7 years ago

Hi Thomas! Thanks for reporting this. The problem you're detailing is actually due to an error in the example's renderMenu implementation. renderMenu's contract is so that it expects - and requires - that every entry in items (the first argument it is passed) is present in the returned tree.

The reason for this is that we do not wish to have to continuously check if the items prepared by renderItem are present in the DOM or not, and then have to adjust the internal workings of the highlight order and keyboard navigation to account for hidden/missing entries. I hope this makes sense.

I've fixed the example and updated the documentation to be more explicit on this matter. Again, thanks for letting us know!