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

Cookie Banner being rendered inside Gutenberg Editor (Metaslider plugin) #413

Open
mateuswetah opened this issue Mar 12, 2024 · 7 comments

Comments

@mateuswetah
Copy link

Hi there! Thank you for the amazing plugin 👍🏼

I would like to report a situation that I am not 100% sure if it is a bug from your side, but it looks like...

I'm building a page using the block editor (Gutenberg) and a slider plugins called Metaslider. When I insert their block, it asks me to select a banner from its list and when I select one, the banner is supposed to be loaded in the editor. However, having Complianz activated, the Cookie consent banner is rendered inside the block 😥 And it also goes very ugly since no styles are rendered:
image

(in the screenshot I even reduced the size of that SVG close button)

While there is a chance that Metaslider is doing something wrong on their side, I wonder if the script that loads the Complianz banner should even be loaded in a scenario like this... Is this something we could change?

@rlankhorst
Copy link
Collaborator

@mateuswetah thanks for your report. The problem where the blame lies is always a difficult one. In this case, the practical solution would be that all plugins like the meta slider plugin set an 'is_preview' flag, that triggers the Gutenberg is_preview() function. This would make it work for all plugins in the same way. In Complianz we already check for this flag, which ensures compatibility 90% of the time.

However, to be pragmatic, I'd like to give you a solution instead of passing the ball to someone else, so I've extended our custom cmplz_is_pagebuilder_preview function to allow for meta slider as well. You can check it by downloading the master from this github repo.

Hope this helps!

@mateuswetah
Copy link
Author

Hi @rlankhorst!

Thank you for the prompt answer! I tried adding the same changes that you made in the last commit to my hosted version of the plugin however the problem remains... but your logic makes sense, that is the action passed by the Meta Slider plugin 🤔

Were you able to reproduce the fix?

@rlankhorst
Copy link
Collaborator

@mateuswetah I have to admit that I was so confident that this would work, that I didn't test it...
Still not tested, but probably working, is the current adjustment. Can you try again? If that doesn't work, I'll try to set up an environment with the metaslider, but was hoping to circumvent that 🙈

@mateuswetah
Copy link
Author

Hhehehe it happens!

But that is so weird... the change you made makes all sense but still has no effect... I guess we'll have to dig a bit more 😢 . Don't worry, take your time with this, maybe it is a simple detail left behind...

@rlankhorst
Copy link
Collaborator

I'll set it up tomorrow, and get back with you with a tested fix 😬

@rlankhorst
Copy link
Collaborator

@mateuswetah I have found the issue. I needed to include the cmplz_is_pagebuilder() condition in the banner loader as well. I thought this was already the case, but apparently the issues we had until now with pagebuilders was mainly the cookie blocker, not the html. This branch fixes the issue (yes, actually tested 😄 ).
https://github.com/Really-Simple-Plugins/complianz-gdpr/tree/meta-slider-integration

To do things properly, it's now added to the test queue, and will get merged after testing.

Let me know if this works for you!

@mateuswetah
Copy link
Author

It works 👯

Thanks for the effort, I'm glad you find some detail that maybe impact other plugins as well! I'll leave to you to close the issue when it is released ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants