diff --git a/packages/js/product-editor/changelog/update-product-editor-show-help-in-the-terms-component b/packages/js/product-editor/changelog/update-product-editor-show-help-in-the-terms-component new file mode 100644 index 00000000000..3e64bb36345 --- /dev/null +++ b/packages/js/product-editor/changelog/update-product-editor-show-help-in-the-terms-component @@ -0,0 +1,4 @@ +Significance: patch +Type: tweak + +Show and locate help for the attribute terms component diff --git a/packages/js/product-editor/src/components/attribute-combobox-field/index.tsx b/packages/js/product-editor/src/components/attribute-combobox-field/index.tsx index eb97f6622ee..b66866e270c 100644 --- a/packages/js/product-editor/src/components/attribute-combobox-field/index.tsx +++ b/packages/js/product-editor/src/components/attribute-combobox-field/index.tsx @@ -37,7 +37,7 @@ interface ComboboxControlProps } /* - * Create an alias for the CombobBoxControl core component, + * Create an alias for the ComboboxControl core component, * but with the custom ComboboxControlProps interface. */ const ComboboxControl = @@ -130,9 +130,6 @@ const AttributesComboboxControl: React.FC< ]; }, [ attributeOptions, createNewAttributeOption ] ); - // Attribute selected flag. - const [ attributeSelected, setAttributeSelected ] = useState( false ); - // Get current of the selected item. let currentValue = current ? `attr-${ current.id }` : ''; if ( createNewAttributeOption.state === 'creating' ) { @@ -180,14 +177,14 @@ const AttributesComboboxControl: React.FC< }, [ instanceNumber ] ); if ( ! help ) { - help = ! attributeSelected ? ( + help = (
{ __( 'Select an attribute or type to create.', 'woocommerce' ) }
- ) : null; + ); if ( isLoading ) { help = ( @@ -238,8 +235,6 @@ const AttributesComboboxControl: React.FC< return onAddNew?.( createNewAttributeOption.label ); } - setAttributeSelected( true ); - const selectedAttribute = items?.find( ( item ) => item.id === diff --git a/packages/js/product-editor/src/components/attribute-control/attribute-table-row.tsx b/packages/js/product-editor/src/components/attribute-control/attribute-table-row.tsx index e67714b0998..9d28eff9e0c 100644 --- a/packages/js/product-editor/src/components/attribute-control/attribute-table-row.tsx +++ b/packages/js/product-editor/src/components/attribute-control/attribute-table-row.tsx @@ -24,6 +24,7 @@ import type { AttributeTableRowProps } from './types'; interface FormTokenFieldProps extends CoreFormTokenField.Props { __experimentalExpandOnFocus: boolean; __experimentalAutoSelectFirstMatch: boolean; + __experimentalShowHowTo?: boolean; placeholder: string; label?: string; } @@ -82,7 +83,6 @@ export const AttributeTableRow: React.FC< AttributeTableRowProps > = ( { onRemove, } ) => { const attributeId = attribute ? attribute.id : undefined; - const { createProductAttributeTerm } = useDispatch( EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME ); @@ -388,6 +388,7 @@ export const AttributeTableRow: React.FC< AttributeTableRowProps > = ( { } } __experimentalExpandOnFocus={ true } __experimentalAutoSelectFirstMatch={ true } + __experimentalShowHowTo={ true } /> diff --git a/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.scss b/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.scss index 8ac00e2a8ad..94f6f0dfcc1 100644 --- a/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.scss +++ b/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.scss @@ -90,7 +90,6 @@ position: absolute; top: 36px; z-index: 0; - display: none; } .components-form-token-field__label { @@ -98,6 +97,9 @@ } .components-form-token-field__input-container { + position: relative; + z-index: 10; + > .components-flex { min-height: 34px; }