@@ -71,11 +71,10 @@ function getPortalProps(props) {
71
71
* Splits props for Portal & Popup.
72
72
*
73
73
* @param {Object } unhandledProps
74
- * @param {Boolean } closed
75
74
* @param {Boolean } disabled
76
75
*/
77
- function partitionPortalProps ( unhandledProps , closed , disabled ) {
78
- if ( closed || disabled ) {
76
+ function partitionPortalProps ( unhandledProps , disabled ) {
77
+ if ( disabled ) {
79
78
return { }
80
79
}
81
80
@@ -123,7 +122,7 @@ const Popup = React.forwardRef(function (props, ref) {
123
122
eventsEnabled = true ,
124
123
flowing,
125
124
header,
126
- hideOnScroll,
125
+ hideOnScroll = false ,
127
126
inverted,
128
127
offset,
129
128
pinned = false ,
@@ -138,18 +137,11 @@ const Popup = React.forwardRef(function (props, ref) {
138
137
wide,
139
138
} = props
140
139
141
- const [ closed , setClosed ] = React . useState ( false )
142
-
143
140
const unhandledProps = getUnhandledProps ( Popup , props )
144
- const { contentRestProps, portalRestProps } = partitionPortalProps (
145
- unhandledProps ,
146
- closed ,
147
- disabled ,
148
- )
141
+ const { contentRestProps, portalRestProps } = partitionPortalProps ( unhandledProps , disabled )
149
142
150
143
const elementRef = useMergedRefs ( ref )
151
144
const positionUpdate = React . useRef ( )
152
- const timeoutId = React . useRef ( )
153
145
const triggerRef = React . useRef ( )
154
146
const zIndexWasSynced = React . useRef ( false )
155
147
@@ -159,12 +151,6 @@ const Popup = React.forwardRef(function (props, ref) {
159
151
160
152
usePositioningEffect ( popperDependencies , positionUpdate )
161
153
162
- React . useEffect ( ( ) => {
163
- return ( ) => {
164
- clearTimeout ( timeoutId . current )
165
- }
166
- } , [ ] )
167
-
168
154
// ----------------------------------------
169
155
// Handlers
170
156
// ----------------------------------------
@@ -179,39 +165,6 @@ const Popup = React.forwardRef(function (props, ref) {
179
165
_ . invoke ( props , 'onOpen' , e , { ...props , open : true } )
180
166
}
181
167
182
- React . useEffect ( ( ) => {
183
- if ( ! hideOnScroll || closed || disabled ) {
184
- return
185
- }
186
- const abortController = new AbortController ( )
187
-
188
- window . addEventListener (
189
- 'scroll' ,
190
- ( e ) => {
191
- debug ( 'handleHideOnScroll()' )
192
-
193
- // Do not hide the popup when scroll comes from inside the popup
194
- // https://github.com/Semantic-Org/Semantic-UI-React/issues/4305
195
- if ( _ . isElement ( e . target ) && elementRef . current . contains ( e . target ) ) {
196
- return
197
- }
198
-
199
- setClosed ( true )
200
-
201
- timeoutId . current = setTimeout ( ( ) => {
202
- setClosed ( false )
203
- } , 50 )
204
-
205
- handleClose ( e )
206
- } ,
207
- { signal : abortController . signal } ,
208
- )
209
-
210
- return ( ) => {
211
- abortController . abort ( )
212
- }
213
- } , [ closed , disabled , elementRef , handleClose , hideOnScroll ] )
214
-
215
168
const handlePortalMount = ( e ) => {
216
169
debug ( 'handlePortalMount()' )
217
170
_ . invoke ( props , 'onMount' , e , props )
@@ -289,7 +242,7 @@ const Popup = React.forwardRef(function (props, ref) {
289
242
} )
290
243
}
291
244
292
- if ( closed || disabled ) {
245
+ if ( disabled ) {
293
246
return trigger
294
247
}
295
248
@@ -348,6 +301,7 @@ const Popup = React.forwardRef(function (props, ref) {
348
301
onUnmount = { handlePortalUnmount }
349
302
trigger = { trigger }
350
303
triggerRef = { triggerRef }
304
+ hideOnScroll = { hideOnScroll }
351
305
>
352
306
< Popper
353
307
modifiers = { modifiers }
0 commit comments