@@ -49,8 +49,6 @@ export const BlockStylesControl = props => {
4949
5050 const prevBlockStyleRef = useRef ( null )
5151 const buttonRef = useRef ( null )
52- const popoverOnCloseTimeout = useRef ( null )
53- const popoverOnCloseRef = useRef ( false )
5452 const panelBodyRef = useRef ( null )
5553
5654 // Reset openProNotice when the popover is closed
@@ -126,6 +124,11 @@ export const BlockStylesControl = props => {
126124 } , [ blockStyle ] )
127125
128126 const onSelectDefaultBlockStyle = ( ) => {
127+ // Do nothing if block style is already "Default"
128+ if ( ! blockStyle ) {
129+ return
130+ }
131+
129132 setAttributes ( { ...defaultBlockAttributes , modifiedBlockStyle : false } )
130133 }
131134
@@ -196,13 +199,7 @@ export const BlockStylesControl = props => {
196199 className = "ugb-button-icon-control__popover ugb-block-styles-controls__popover"
197200 focusOnMount = { false }
198201 onEscape = { ( ) => setOpenPopover ( false ) }
199- onClose = { ( ) => {
200- setOpenPopover ( false )
201- // This prevents the popover from reopening if the button was clicked
202- popoverOnCloseRef . current = true
203- clearTimeout ( popoverOnCloseTimeout . current )
204- popoverOnCloseTimeout . current = setTimeout ( ( ) => popoverOnCloseRef . current = false , 100 )
205- } }
202+ onClose = { ( ) => setOpenPopover ( false ) }
206203 anchor = { buttonRef . current }
207204 offset = { 8 }
208205 placement = "left-start"
@@ -218,6 +215,7 @@ export const BlockStylesControl = props => {
218215 < Button
219216 onClick = { ( ) => onSelectDefaultBlockStyle ( ) }
220217 className = { ! blockStyle ? 'ugb-block-styles-controls__selected' : '' }
218+ tabIndex = { 0 }
221219 >
222220 { ! blockStyle && < span className = "ugb-block-styles-controls__selected-icon" > < Dashicon icon = "saved" /> </ span > }
223221 < span className = "ugb-block-styles-controls__label" > { __ ( 'Default' , i18n ) } </ span >
@@ -228,6 +226,7 @@ export const BlockStylesControl = props => {
228226 < Button
229227 onClick = { ( ) => onSelectBlockStyle ( option . slug ) }
230228 className = { blockStyle === option . slug ? 'ugb-block-styles-controls__selected' : '' }
229+ tabIndex = { 0 }
231230 >
232231 { blockStyle === option . slug && < span className = "ugb-block-styles-controls__selected-icon" > < Dashicon icon = "saved" /> </ span > }
233232 < span className = "ugb-block-styles-controls__label" >
@@ -287,7 +286,7 @@ const SaveUpdateButtons = props => {
287286 }
288287
289288 return ( < >
290- < Flex style = { { marginTop : '24px' } } >
289+ < Flex style = { { marginTop : '24px' } } direction = "column" align = "flex-end" >
291290 < FlexItem >
292291 < UpdateButton
293292 blockStyle = { blockStyle }
0 commit comments