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

Duotone filter not rendering in some places #35331

Closed
ajlende opened this issue Oct 4, 2021 · 10 comments
Closed

Duotone filter not rendering in some places #35331

ajlende opened this issue Oct 4, 2021 · 10 comments
Assignees
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@ajlende
Copy link
Contributor

ajlende commented Oct 4, 2021

Description

When applying duotone as a block style in theme.json, there are still a couple places the duotone filter doesn't get applied.

See #34667 (comment)

The thumbnail for block patterns that use duotone won't show the filter applied:
Screenshot 2021-09-29 at 17 22 27

The site editor shows the image without a filter but the frontend works fine. The post editor when I insert an image does work fine:
Screenshot 2021-09-29 at 17 22 51

To reproduce

You can test on Skatepark applying Automattic/themes#4740

Or by adding the following to your theme.json for testing the image and cover blocks.

{
	"styles": {
		"blocks": {
			"core/cover": {
				"filter": {
					"duotone": "var(--wp--preset--duotone--blue-red)"
				}
			},
			"core/image": {
				"filter": {
					"duotone": "var(--wp--preset--duotone--blue-red)"
				}
			}
		}
	}
}
@ajlende ajlende added [Type] Bug An existing feature does not function as intended [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Oct 4, 2021
@ajlende ajlende self-assigned this Oct 4, 2021
@ajlende
Copy link
Contributor Author

ajlende commented Oct 4, 2021

The SVG containing the filter is generated during the admin_footer hook which, I think, is causing the issue.

The assets for the site editor are generated during the admin_footer-toplevel_page_gutenberg-edit-site hook which is the last hook in admin-footer.php, so the SVG never gets rendered.

@carolinan
Copy link
Contributor

Did you try without using a preset var?

@andrewserong
Copy link
Contributor

andrewserong commented Oct 12, 2021

I'm currently working on refactoring a few of the block supports to ensure they render correctly in the site editor in #35450. I think I've managed to get it working properly for Duotone in the Site Editor (haven't tested block patterns thumbnails yet) by outputting to wp_footer instead of admin_footer, but I'm keen for feedback on the PR as there's a lot of context to how Duotone was implemented that I might have missed! 🙂

@oandregal
Copy link
Member

I'm marking this for 5.9. Please, feel free to remove if it isn't necessary.

@oandregal
Copy link
Member

Braindump for when someone is able to pick this up.

While working on #36236 I discussed with Alex that for duotone to work on the site editor we need to port the same changes introduced in the server at #34667 (and follow-ups). Refs:

@Mamaduka
Copy link
Member

Mamaduka commented Jan 5, 2022

@oandregal, I'm removing this issue from WP 5.9 project board.

Feel free to add it back to a minor release board once it's created.

@ndiego
Copy link
Member

ndiego commented Apr 19, 2022

@ajlende can this be closed now that #37727 is merged?

@ndiego ndiego moved this from Todo to In Progress in WordPress 6.0 Editor Tasks Apr 19, 2022
@ajlende
Copy link
Contributor Author

ajlende commented Apr 19, 2022

#37727 solved the problem for the site editor, but I've confirmed that there are still issues with the block/pattern previews.

Screen Shot 2022-04-19 at 11 19 44 AM

I haven't investigated why yet, but it seems some of the patterns are working, just not all of them.

Screen Shot 2022-04-19 at 11 38 18

@matiasbenedetto
Copy link
Contributor

matiasbenedetto commented May 12, 2022

A small PR with a potential fix for this issue: #41249

@ajlende
Copy link
Contributor Author

ajlende commented Jun 22, 2022

Fixed by #41249

@ajlende ajlende closed this as completed Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants