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 selector does not apply when using Image block alignment #54121

Closed
sabernhardt opened this issue Sep 1, 2023 · 6 comments · Fixed by #59764
Closed

Duotone filter selector does not apply when using Image block alignment #54121

sabernhardt opened this issue Sep 1, 2023 · 6 comments · Fixed by #59764
Assignees
Labels
[Block] Image Affects the Image Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@sabernhardt
Copy link
Contributor

sabernhardt commented Sep 1, 2023

Description

(reported earlier on Trac 59138)

Duotone filters seem to fail in any 'classic' theme when the image has an alignment class because the duotone classes are added to the figure element, and that is not the same as the .wp-block-image element in classic themes. The selector in block.json expects both classes to be on the same element.

.wp-duotone-cf2e2e-abb8c3-1.wp-block-image img,
.wp-duotone-cf2e2e-abb8c3-1.wp-block-image .components-placeholder {
  filter: url(#wp-duotone-cf2e2e-abb8c3-1);
}

Changing .wp-block-image to [class] in that line of the block JSON worked for me in the bundled themes (Twenty Ten to Twenty Twenty-Three), though I do not know if the .wp-block-image class was necessary somehow.

Step-by-step reproduction instructions

  1. Activate a 'classic' theme such as Twenty Seventeen.
  2. Create a new post.
  3. Add an Image block.
  4. Select one of the block's Alignment options (left, center or right).
  5. Give duotone Highlight and Shadow colors to the block.
  6. Preview the post on the front end.

Screenshots, screen recording, code snippet

Image blocks with each alignment option, on the front end, with Twenty Seventeen

duotone effect only works on image with no alignment

Environment info

WordPress 6.3 and 6.3.1, without the Gutenberg plugin
Windows 10, with both Firefox and Chrome

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

@sabernhardt
Copy link
Contributor Author

sabernhardt commented Sep 1, 2023

When I activated Gutenberg 16.5.1, the styles did not print, so even unaligned image blocks did receive the duotone effect. (And after experiencing that in the post I created earlier, I again had no duotone with an unaligned image in a new post.)

no images have the duotone effect

@jordesign jordesign added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. [Block] Image Affects the Image Block labels Sep 4, 2023
@bph
Copy link
Contributor

bph commented Sep 4, 2023

Seems to be a similar problem as in

@sabernhardt
Copy link
Contributor Author

#54099 is probably related to the missing styles in the latest plugin version, but not the bug first reported on Trac about the aligned images. The faulty CSS selector is a regression in WordPress 6.3, which might be fixable in a minor release.

@ndiego
Copy link
Member

ndiego commented Sep 5, 2023

Thanks for reporting. I can confirm. Updating the issue labels.

@ndiego ndiego removed the Needs Testing Needs further testing to be confirmed. label Sep 5, 2023
@annezazu
Copy link
Contributor

annezazu commented Sep 6, 2023

Noting for @ajlende in case you can share any insights!

@annezazu
Copy link
Contributor

annezazu commented Feb 8, 2024

After a review by core editor triage leads and core editor tech leads, this has been removed from the board for 6.5 consideration.

ajlende added a commit that referenced this issue Mar 11, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 11, 2024
scruffian pushed a commit that referenced this issue Mar 12, 2024
…ontainer in classic themes (#59764)

Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: scruffian <scruffian@git.wordpress.org>
Co-authored-by: bph <bph@git.wordpress.org>
Co-authored-by: ndiego <ndiego@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
Co-authored-by: sabernhardt <sabernhardt@git.wordpress.org>

* Add filter for duotone to account for gutenberg_restore_image_outer_container in classic themes.

Fixes #54121

* Try making things a bit more efficient

* Fix phpcs

* Fix phpcs

* Reuse if class_exists block

* Fix phpcs
carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this issue Mar 27, 2024
…ontainer in classic themes (WordPress#59764)

Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: scruffian <scruffian@git.wordpress.org>
Co-authored-by: bph <bph@git.wordpress.org>
Co-authored-by: ndiego <ndiego@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
Co-authored-by: sabernhardt <sabernhardt@git.wordpress.org>

* Add filter for duotone to account for gutenberg_restore_image_outer_container in classic themes.

Fixes WordPress#54121

* Try making things a bit more efficient

* Fix phpcs

* Fix phpcs

* Reuse if class_exists block

* Fix phpcs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
6 participants