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

blockbase checkbox for duotone #4948

Closed
wants to merge 9 commits into from

Conversation

MaggieCabrera
Copy link
Contributor

@MaggieCabrera MaggieCabrera commented Oct 29, 2021

Do not Merge

Can be merged once this issue has been brought in and has landed on wpcom : WordPress/gutenberg#36236

Changes proposed in this Pull Request:

This PR adds a checkbox for themes that have duotone support that allows the user to turn it off for any blocks that have it set in theme.json directly from the customizer.

Screenshot 2021-11-04 at 13 12 33

There are two known issues with this approach:

  • If we uncheck the duotone checkbox and reload the customizer page and check it back again, the preview will not show the filter (but it will work in the frontend). There's no easy way around this because when the filter is off we don't know which selectors to apply it back on.
  • On non dev environments (with no debug settings on) the transient cache from Gutenberg removes the SVG filters, Ben has opened an issue upstream but this effectively breaks the duotone filters in the frontend. That's happening regardless of this PR too, we just uncovered that while testing this.
    EDIT: the cache issue is solved by Fix duotone theme cache WordPress/gutenberg#36236

Related issue(s):

Closes #4434

@MaggieCabrera MaggieCabrera force-pushed the blockbase-checkbox-for-duotone branch 2 times, most recently from 01e7460 to 09469c3 Compare November 4, 2021 11:34
@MaggieCabrera MaggieCabrera marked this pull request as ready for review November 4, 2021 12:16
@MaggieCabrera MaggieCabrera self-assigned this Nov 4, 2021
@MaggieCabrera MaggieCabrera added [Theme] Blockbase [Theme] Skatepark Automatically generated label for Skatepark. labels Nov 4, 2021
@MaggieCabrera MaggieCabrera requested a review from a team November 4, 2021 12:17
@scruffian
Copy link
Member

This is looking great, just a few small comments.

@pbking
Copy link
Contributor

pbking commented Nov 10, 2021

Works great for me locally. Wasn't working as expected on wpcom.

May be due to the cacheing issue. If so suggest we just park this until that has been fixed and shipped. Not sure how to determine that that is the problem though.

@MaggieCabrera
Copy link
Contributor Author

Works great for me locally. Wasn't working as expected on wpcom.

May be due to the cacheing issue. If so suggest we just park this until that has been fixed and shipped. Not sure how to determine that that is the problem though.

yes, you can reproduce the problem locally! you just need to remove the dev env variables that are circumventing the cache in the first place. We definitely need the fix before we launch the theme, but with it, the problem goes away (at least for me, locally)

Copy link
Contributor

@pbking pbking left a comment

Choose a reason for hiding this comment

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

👍

Thanks @MaggieCabrera

yes, you can reproduce the problem locally! you just need to remove the dev env variables that are circumventing the cache in the first place. We definitely need the fix before we launch the theme, but with it, the problem goes away

Confirmed the problem exists and is fixed by the linked issue. Approving these changes to ship once that lands.

@MaggieCabrera
Copy link
Contributor Author

I had to add a change because I had JS errors on Blockbase with the original PR, care to have a quick look again @scruffian?

var enabledDuotone = duotoneVars[ 'duotoneControl' ] === '1' ? true : false;
var enabledDuotone = false;

if ( window.duotoneVars ) {
Copy link
Member

Choose a reason for hiding this comment

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

does this need to be window.duotoneVars? Couldn't it just be duotoneVars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it didn't work that way!

Uncaught ReferenceError: duotoneVars is not defined

Copy link
Member

Choose a reason for hiding this comment

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

I think you need to check the type of duotoneVars:

if ( typeof duotoneVars !== 'undefined' ) {

but I suppose your way works too

@MaggieCabrera
Copy link
Contributor Author

I think we should rebase this and check if it still works and then deploy to .org!

@scruffian
Copy link
Member

This needs WordPress/gutenberg#38055 to be merged before it will work.

@scruffian scruffian force-pushed the blockbase-checkbox-for-duotone branch from 050ee86 to 1a2b059 Compare February 2, 2022 16:06
@scruffian
Copy link
Member

I rebased this and gave it another test and it still works. If someone else could confirm we can bring it in!

@MaggieCabrera
Copy link
Contributor Author

I rebased this and gave it another test and it still works. If someone else could confirm we can bring it in!

I don't know if I'll have time today, but did you check dotcom? last time I tried it didn't work in there

@scruffian scruffian force-pushed the blockbase-checkbox-for-duotone branch from 1a2b059 to 813d146 Compare February 2, 2022 17:27
@scruffian
Copy link
Member

It's hard to test on wpcom because the Gutenberg fix isn't there, but the customizer preview is working there.

@pbking
Copy link
Contributor

pbking commented Feb 2, 2022

I just checked on edge sites on dotcom. Seems 12.5 just landed there. However the ability to enable/disable the duotone still didn't seem to be working. It does work locally as described.

@scruffian
Copy link
Member

The fix only landed in GB today so it won't be in 12.5

@MaggieCabrera
Copy link
Contributor Author

I think we should close this after we discussed this

@scruffian scruffian deleted the blockbase-checkbox-for-duotone branch February 7, 2022 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Theme] Blockbase [Theme] Skatepark Automatically generated label for Skatepark.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add User-Configurable Duotone option to Customizer
3 participants