File tree Expand file tree Collapse file tree 1 file changed +12
-15
lines changed
Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -152,26 +152,23 @@ function Portal(props) {
152152 if ( ! hideOnScroll ) {
153153 return
154154 }
155- const abortController = new AbortController ( )
156155
157- window . addEventListener (
158- 'scroll' ,
159- ( e ) => {
160- debug ( 'handleHideOnScroll()' )
156+ const handleScroll = ( e ) => {
157+ debug ( 'handleHideOnScroll()' )
161158
162- // Do not hide the popup when scroll comes from inside the popup
163- // https://github.com/Semantic-Org/Semantic-UI-React/issues/4305
164- if ( _ . isElement ( e . target ) && contentRef . current . contains ( e . target ) ) {
165- return
166- }
159+ // Do not hide the popup when scroll comes from inside the popup
160+ // https://github.com/Semantic-Org/Semantic-UI-React/issues/4305
161+ if ( _ . isElement ( e . target ) && contentRef . current . contains ( e . target ) ) {
162+ return
163+ }
167164
168- closePortal ( e )
169- } ,
170- { signal : abortController . signal , passive : true } ,
171- )
165+ closePortal ( e )
166+ }
167+
168+ window . addEventListener ( 'scroll' , handleScroll , { passive : true } )
172169
173170 return ( ) => {
174- abortController . abort ( )
171+ window . removeEventListener ( 'scroll' , handleScroll )
175172 }
176173 } , [ closePortal , hideOnScroll ] )
177174
You can’t perform that action at this time.
0 commit comments