-
Notifications
You must be signed in to change notification settings - Fork 808
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
Calendly: Change buttons to a standard link for AMP requests #14630
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: April 7, 2020. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might consider adding and target="_blank
+ rel="noopener noreferrer"
when the embed functions as a regular link.
Also, the way the Eventbrite block approaches this might be interesting, since it naturally functions as a regular link when the event handler doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well for me and makes the link functional within the AMP page.
b97687f
36fb44d
to
b97687f
Compare
pablinos, Your synced wpcom patch D38684-code has been updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to handle the inline style as well as we're working on this.
pablinos, Your synced wpcom patch D38684-code has been updated. |
I've changed the approach to be similar to the way we've implemented the Eventbrite block. I'm thinking that we can update the This inlines the styles for the when custom colours are used. Is that what you were thinking @jeherve? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using the button style, this seems to break an existing button until I edit the page, make a change to the block, and re-save. Is there a way we can avoid that?
I've been testing this and had a problem with setting a custom text colour on the button. The problem meant the colour wouldn't be displayed in the editor, but would be used in the frontend. I've fixed that in 3c15158 Could you let me know if you're still seeing any issues please @jeherve? |
@jeherve @pablinos Apparently there's something going on with If I deactivate the Guten plugin, I can change the button colors just fine, in both this branch and master. But with the Guten plugin enabled, the color controls work in kind of unexpected ways.
EDIT: just to clarify, whatever is happening it's not related to this PR. EDIT 2: I think there's something more complicated going on here, because at some point I got to make it work on any branch and on both Calendly and Contact Form, but now I can't again. |
This is weird as the button text colour is definitely broken in master at the moment. I've been playing with different combinations, trying to replicate the problems you saw @Copons, but I'm struggling to get it to break with and without Gutenberg activated. Is there any chance you could test it again @Copons and see if you can get it to consistently fail? |
pablinos, Your synced wpcom patch D38684-code has been updated. |
So, this is step by step everything I've tested: MASTER, NO GUTENBERG
Apparently, Contact Form only saves named colors as CSS classes, but not as attributes? (Custom colors are saved correctly, e.g. Comparison:
MASTER, GUTENBERG ACTIVE
Same behaviour with or without Gutenberg. PR 14630, NO GUTENBERG
PR 14630, GUTENBERG ACTIVE
In Calendly's case, I think it's caused by our re-implementation of the Core Button block (and 6eb1b38 is my proposed fix). |
6eb1b38
to
30a52b9
Compare
pablinos, Your synced wpcom patch D38684-code has been updated. |
I've changed the I've done a load of testing with and without the Gutenberg plugin, as well as creating a button on the master branch, and swapping to this one. The only difference is this branch has the fix for the So, I'm hoping this is ready for a final review. |
I think there's yet another thing going on here... 😭
After more investigation: this happens on master as well. |
Ok @pablinos I think I know what's happening here with the clear, but before committing I need more context with Basically the culprit lies in these 4 lines: jetpack/extensions/shared/submit-button.js Lines 89 to 92 in 557a85a
When this jetpack/extensions/shared/submit-button.js Lines 42 to 44 in 557a85a
This means that these two down here will always have a value: const backgroundColor = backgroundButtonColor.color || fallbackBackgroundColor;
const color = textButtonColor.color || fallbackTextColor; Now, this is what happens (I'll only talk about the background for clarity):
So far so good.
What does this very verbose example means? It means that falling back to the const backgroundColor = backgroundButtonColor.color || fallbackBackgroundColor;
const color = textButtonColor.color || fallbackTextColor; The first time we add a block we don't realize it, because the But, when we load a button with a different color, this becomes the new I'm not entirely sure of the purpose of the Core's I hope I've been clear enough, but the comment is very long and verbose so I might not have been clear at all. 😅 |
Nice sleuthing @Copons! I didn't test the clearing of the colour, so I'm glad you did. At first glance, I'm not sure if the new I have seen other resets working this way, that it resets the value to the last saved value, so maybe that is the logic here? Maybe some testing with the hook is in order, and if that works we can backport the fallback stuff to |
Per our team discussion today, I'm assigning this to @Copons to re-evaluate for the next steps (whether to review and get this merged or drop it in favor of more holistic updates to block buttons. |
Closing this as it will be fixed with the new Button inner block. |
AMP strips out
onClick
handlers, so when the button version ofthe block is rendered we should change it to a standard link to the Calendly
appointment page.
We could probably get around this by attaching the click handler in
another way, but it would still be good to treat an AMP request
differently.
Is this a new feature or does it add/remove features to an existing part of Jetpack?
This a bug fix to a new feature
Testing instructions:
Proposed changelog entry for your changes:
No changelog is necessary.