Skip to content

Commit 255bc61

Browse files
authored
fix (block styles): css specificity and revert hover state (#3569)
1 parent 8b0974d commit 255bc61

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
useEffect,
3434
useMemo, useRef, useState,
3535
} from '@wordpress/element'
36-
import { useSelect } from '@wordpress/data'
36+
import { useSelect, dispatch } from '@wordpress/data'
3737
import { getBlockType } from '@wordpress/blocks'
3838
import { applyFilters, doAction } from '@wordpress/hooks'
3939

@@ -199,6 +199,9 @@ export const BlockStylesControl = props => {
199199
}
200200

201201
setAttributes( { ...defaultBlockAttributes, modifiedBlockStyle: false } )
202+
203+
// Reset to normal state after selecting block style
204+
dispatch( 'stackable/hover-state' ).updateHoverState( 'normal' )
202205
}
203206

204207
const onSelectBlockStyle = ( option, index ) => {

src/util/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export const prependCSSClass = ( cssSelector, mainClassName = '', uniqueClassNam
296296
}
297297

298298
if ( hasHoverStateSelector && hoverStateSelector && wrapSelector ) {
299-
return `${ hoverStateSelector }${ wrapSelector } ${ newSelector }`
299+
return `${ wrapSelector }:where(${ hoverStateSelector }) ${ newSelector }`
300300
}
301301

302302
return wrapSelector ? `${ wrapSelector } ${ newSelector }` : newSelector

0 commit comments

Comments
 (0)