when I started writing on an input field in a simple form it displays an auto suggestion list of old data (autocomplete), when the (window scroll) it disappear and every thing is working fine.
but when I put the input field in antd modal which includes (other scroller) the suggestion list is still appearing when I scroll up/down.
A solution came to my mind which is adding event listener to antd modal scroller (ant-modal-wrapper) so when it is moved I turned off the auto suggestion feature. but I couldn’t find way to add listener to that scroller cuz it is not (window.scroll).
I tried to use jquery also, like
$(".ant-modal-wrapper").on("scroll", function() {
console.log("Scrolling");
});
but did not work.
Also I used onScroll property inside modal div but did not work.
this is a screenshot may help to explain this issue in antd modal
suggestions list before scrolling
suggestions list after scrolling down
any suggestions or better solution to fix my issue would be helpful. thank you
Do the following to hide options of Autocomplete inside modal.
optionsOpenand assign it as a value toopenprop of Autocompletescrollin componentDidMount and update the state to false. This will cause the option to close when user does a scroll.Working demo is here
Code Snippet