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

Fix duotone first render in Safari #36754

Merged
merged 1 commit into from
Nov 24, 2021
Merged

Conversation

ajlende
Copy link
Contributor

@ajlende ajlende commented Nov 22, 2021

Description

In Safari the duotone filters were not painting in the sRGB color space on the initial render. Forcing a re-paint of the element would fix the filter's color space. From some testing, I found that moving the SVG filters before the filtered elements fixed the issue.

How has this been tested?

In Safari, load a post that includes a duotone filter applied via block controls and another duotone filter applied via theme.json.

See that the filter renders correctly.

Screenshots

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@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 Nov 22, 2021
@ajlende ajlende self-assigned this Nov 22, 2021
Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

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

Nice. I tried with a custom configured duotone preset, and one set via theme.json using this:

    "blocks": {
      "core/image": {
        "filter": {
          "duotone": "var(--wp--preset--duotone--blue-red)"
        }
      },
    }

Before:
before

After:

after

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

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

Wonderful, thanks for the fix! Makes sense to me. I trust that the visibility parameters set on SVG were good enough for the footer and hence are good enough for the opening of the body, right? :)

@ajlende ajlende merged commit 5cf67a8 into trunk Nov 24, 2021
@ajlende ajlende deleted the fix/duotone-safari-first-render branch November 24, 2021 15:13
@github-actions github-actions bot added this to the Gutenberg 12.1 milestone Nov 24, 2021
@mcsf mcsf added the Browser Issues Issues or PRs that are related to browser specific problems label Jan 21, 2022
@Mamaduka
Copy link
Member

Cherry-picked for 5.9.1. Mostly to fix merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser Issues Issues or PRs that are related to browser specific problems [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants