[Experimental] Rating filter: fix block focus and visibility (#52579)

This commit is contained in:
Tung Du 2024-11-06 10:53:39 +07:00 committed by GitHub
parent f55759b892
commit 7c7895ade9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 25 deletions

View File

@ -32,6 +32,7 @@ import { EXCLUDED_BLOCKS } from '../../constants';
import { Notice } from '../../components/notice';
import type { Attributes } from './types';
import './style.scss';
import { InitialDisabled } from '../../components/initial-disabled';
const RatingFilterEdit = ( props: BlockEditProps< Attributes > ) => {
const { attributes, setAttributes } = props;
@ -189,30 +190,32 @@ const RatingFilterEdit = ( props: BlockEditProps< Attributes > ) => {
/>
<div { ...innerBlocksProps }>
{ showNoProductsNotice && (
<Notice>
{ __(
"Your store doesn't have any products with ratings yet. This filter option will display when a product receives a review.",
'woocommerce'
) }
</Notice>
) }
<div
className={ clsx( {
'is-loading': isLoading,
} ) }
>
<BlockContextProvider
value={ {
filterData: {
items: displayedOptions,
isLoading,
},
} }
<InitialDisabled>
{ showNoProductsNotice && (
<Notice>
{ __(
"Your store doesn't have any products with ratings yet. This filter option will display when a product receives a review.",
'woocommerce'
) }
</Notice>
) }
<div
className={ clsx( {
'is-loading': isLoading,
} ) }
>
{ children }
</BlockContextProvider>
</div>
<BlockContextProvider
value={ {
filterData: {
items: displayedOptions,
isLoading,
},
} }
>
{ children }
</BlockContextProvider>
</div>
</InitialDisabled>
</div>
</>
);

View File

@ -1,6 +1,4 @@
.wp-block-woocommerce-product-filter-rating {
display: grid;
.wc-block-components-product-rating {
margin-bottom: 0;
display: flex;

View File

@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Experimental: Rating filter: fix block focus and visibility