Skip to content

Commit

Permalink
Remove Create option from initial suggestions
Browse files Browse the repository at this point in the history
Addresses #18900 (comment)

If we need to reinstate this functionality we can simply revert this commit.
  • Loading branch information
getdave committed Jan 30, 2020
1 parent 2ae6c6a commit 43be19d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function LinkControl( {

const directLinkEntryTypes = [ 'url', 'mailto', 'tel', 'internal' ];
const isSingleDirectEntryResult = suggestions.length === 1 && directLinkEntryTypes.includes( suggestions[ 0 ].type.toLowerCase() );
const shouldShowCreateEntity = showCreateEntity && createEntity && ! isSingleDirectEntryResult;
const shouldShowCreateEntity = showCreateEntity && createEntity && ! isSingleDirectEntryResult && ! isInitialSuggestions;

// According to guidelines aria-label should be added if the label
// itself is not visible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
expect( currentLinkHTML ).toEqual( expect.stringContaining( '/?p=123' ) ); // slug
} );

it( 'should show option to create "blank" entity in initial suggestions (when input is empty)', async () => {
it( 'should show not show an option to create "blank" entity in initial suggestions (when input is empty)', async () => {
act( () => {
render(
<LinkControl
Expand Down Expand Up @@ -489,8 +489,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {

// Verify input has no value
expect( searchInput.value ).toBe( '' );
expect( createButton ).not.toBeNull();
expect( createButton.innerHTML ).toEqual( expect.stringContaining( 'Create new' ) );
expect( createButton ).toBeNull(); // shouldn't exist!
} );

it.each( [
Expand Down

0 comments on commit 43be19d

Please sign in to comment.