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

Featured Image Blocks Hide all Settings if there is no query block in the same document #49560

Closed
tomjn opened this issue Apr 3, 2023 · 2 comments · Fixed by #49609
Closed
Assignees
Labels
[Block] Post Featured Image Affects the Post Featured Image Block [Type] Bug An existing feature does not function as intended

Comments

@tomjn
Copy link
Contributor

tomjn commented Apr 3, 2023

Description

This made sense when the line was written:

https://github.com/WordPress/gutenberg/blame/trunk/packages/block-library/src/post-featured-image/edit.js#L189

	/**
	 * A post featured image block placed in a query loop
	 * does not have image replacement or upload options.
	 */
	if ( ! featuredImage && isDescendentOfQueryLoop ) {
		return (
			<>
				{ controls }
				<div { ...blockProps }>
					{ placeholder() }
					<Overlay
						attributes={ attributes }
						setAttributes={ setAttributes }
						clientId={ clientId }
					/>
				</div>
			</>
		);
	}

But controls are used for more than that now! Since then featured image blocks have had new options added, particularly the "Link to post" toggle which sits inside this check in the controls component.

Step-by-step reproduction instructions

Use a featured post image block in a document that does not contain a query block.

In my situation I have a template part inside a query block + post template block, and because of this the featured image inside the template part does not have the option to enable post links, and wipes it if I add it manually and reopen

Screenshots, screen recording, code snippet

No response

Environment info

WordPress v6.2

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@ndiego ndiego added the Needs Testing Needs further testing to be confirmed. label Apr 4, 2023
@ndiego
Copy link
Member

ndiego commented Apr 4, 2023

I have been able to replicate this.

  1. Add a new template part
  2. Add a Post Featured Image block to a template part
  3. Edit the Post Featured Image block and notice that the Settings are not displayed

image

@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Block] Post Featured Image Affects the Post Featured Image Block and removed Needs Testing Needs further testing to be confirmed. labels Apr 4, 2023
@annezazu
Copy link
Contributor

annezazu commented Apr 4, 2023

@ntsekouras or @apeatling can you look into this?

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Apr 5, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Featured Image Affects the Post Featured Image Block [Type] Bug An existing feature does not function as intended
5 participants