Skip to content

Commit d43856a

Browse files
committed
fix popover onclose
1 parent 0e1bde0 commit d43856a

File tree

1 file changed

+3
-2
lines changed
  • src/components/block-styles-control

1 file changed

+3
-2
lines changed

src/components/block-styles-control/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const BlockStylesControl = props => {
4848

4949
const prevBlockStyleRef = useRef( null )
5050
const buttonRef = useRef( null )
51+
const popoverOnCloseTimeout = useRef( null )
5152
const popoverOnCloseRef = useRef( false )
5253

5354
const mainClasses = classnames( [
@@ -190,10 +191,10 @@ export const BlockStylesControl = props => {
190191
setOpenPopover( false )
191192
// This prevents the popover from reopening if the button was clicked
192193
popoverOnCloseRef.current = true
193-
setTimeout( () => popoverOnCloseRef.current = false, 100 )
194+
clearTimeout( popoverOnCloseTimeout.current )
195+
popoverOnCloseTimeout.current = setTimeout( () => popoverOnCloseRef.current = false, 100 )
194196
} }
195197
anchor={ buttonRef.current }
196-
placement="bottom-end"
197198
offset={ 8 }
198199
>
199200
<PanelBody>

0 commit comments

Comments
 (0)