Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostTaxonomiesFlatTermSelector: Restore space between tag list and most used tags #66566

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
* WordPress dependencies
*/
import { __, _x, sprintf } from '@wordpress/i18n';
import { useEffect, useMemo, useState } from '@wordpress/element';
import { FormTokenField, withFilters } from '@wordpress/components';
import { Fragment, useEffect, useMemo, useState } from '@wordpress/element';
import {
FormTokenField,
withFilters,
__experimentalVStack as VStack,
} from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { store as coreStore } from '@wordpress/core-data';
Expand Down Expand Up @@ -288,8 +292,15 @@ export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
singularName
);

const Wrapper = ( { children } ) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is creating a new component every time it's re-rendered. It's causing the focus to be lost after adding a new tag. Since this is a regression, let's fix this before RC 3 🙏.

__nextHasNoMarginBottom ? (
<VStack spacing={ 4 }>{ children }</VStack>
) : (
<Fragment>{ children }</Fragment>
);

return (
<>
<Wrapper>
<FormTokenField
__next40pxDefaultSize
value={ values }
Expand All @@ -306,7 +317,7 @@ export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
/>
<MostUsedTerms taxonomy={ taxonomy } onSelect={ appendTerm } />
</>
</Wrapper>
);
}

Expand Down
Loading