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

amp-bind not working anymore after upgrading to 1.2.0 #2815

Closed
sboerrigter opened this issue Jul 15, 2019 · 9 comments
Closed

amp-bind not working anymore after upgrading to 1.2.0 #2815

sboerrigter opened this issue Jul 15, 2019 · 9 comments
Labels
Support Help with setup, implementation, or "How do I?" questions.

Comments

@sboerrigter
Copy link

sboerrigter commented Jul 15, 2019

Hi There,

I noticed that custom amp-bind functions I added in my theme are not working anymore after upgrading from amp 1.1.3 to 1.2.0. So for example something like this doesn't work anymore:

<button on="tap:showme.show">
  Show content
</button>

<div id="showme" hidden>
  Hi there :-)
</div>

It also doesn't work when I add the amp-bind script to the head of the theme:

<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>

I could not find anything about this in the documentation or in the changelog of version 1.2.0.

I also tried to add the same code to the twentynineteen theme and have the same problem there. It does work with version 1.1.3, but not with version 1.2.0.

Is this a bug, or am I doing something stupid? Thanks in advance!

@swissspidy swissspidy added the Support Help with setup, implementation, or "How do I?" questions. label Jul 15, 2019
@westonruter
Copy link
Member

@sboerrigter Hi. The code you shared is actually not amp-bind, so that is why the amp-bind script is not being added. It's just AMP actions and events that are in the AMP framework without any additional script needed. You can paste your code into https://playground.amp.dev/ without any other scripts being added.

So what is not working?

@sboerrigter
Copy link
Author

sboerrigter commented Jul 15, 2019

Thanks for your quick reply and clearification about amp-bind.

In my example the problem is that the text "Hi there :-)" is not shown when the "Show content" button is clicked. This did work with version 1.1.3 of the AMP plugin.

@westonruter
Copy link
Member

@sboerrigter Please share the URL to the page where we can see the issue.

@sboerrigter
Copy link
Author

I only have updated the plugin on a local testing environment. So I don't have a public example of the problem.

I just tried to recreate the problem on a clean WordPress install and I think I found the problem. We were using the AMP plugin in "Paired" mode, but after updating the AMP plugin to version 1.2.0 this mode no longer existed and the "Reader" mode was automatically activated. After switching to "Transitional" mode the AMP actions and events work again.

Maybe it makes more sense if "Transitional" mode is selected when upgrading to version 1.2.0 when the AMP plugin was in "Paired" mode.

Thanks for your help!

@westonruter
Copy link
Member

westonruter commented Jul 17, 2019

Humm. We specifically made it so that a site on Paired mode would be automatically updated to Transitional mode in 1.2 via #2550:

} elseif ( 'paired' === $options['theme_support'] ) {
$options['theme_support'] = AMP_Theme_Support::TRANSITIONAL_MODE_SLUG;

So I'm confused why this didn't work for you.

@westonruter
Copy link
Member

Also, AMP actions and events should work the same regardless of the mode you are in.

@sboerrigter
Copy link
Author

Hmm, ok. I am not sure what's wrong then. At least is seems to work for my situation.

Do you need anything more from me to see if you can find the problem? Or do you prefer to leave it with this? Either is fine to me.

@westonruter
Copy link
Member

Not sure what else to do here, as the issue hasn't been reported by anyone else. Only potential thing to do here would be if you can restore a backup of your site on another environment to try to reproduce the bug and then debug why the above code is not working for you.

@sboerrigter
Copy link
Author

Hmm, if no-one else is experiencing this issue I am ok with closing this. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

3 participants