You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #5356 I'm working on fixing #771 which involves catching better handling of validation errors caused by including i-amphtml- in a stylesheet (instead of this causing the entire stylesheet to be removed, only the bad selector should be removed). I was trying to add this to the stylesheet and then seeing the behavior of forcibly keeping the invalid CSS. But when I changed the status from Removed to Kept and clicked Preview, I did not see the CSS being kept on the page. What's going on?
First of all, the validation error for a style element (currently) includes the full text of the element as one of the error properties (which probably shouldn't be done for amp-custom or amp-keyframes). Any change to the stylesheet causes a separate validation error to be created, since the validation error is identified by a hash of the error properties.
Secondly, I have Jetpack active locally, and it is configured to display the sharing buttons on the page. And herein lies the problem: Jetpack's Sharing module is configured to not show anything if is_preview() returns true, and when clicking the Preview button on the Validated URL screen, the URL includes the preview=1 query parameter. The result is different HTML is on the previewed page, and this results in different tree-shaken CSS, and thus different content for the style[amp-custom] element. This is unexpected.
In reality, I don't believe the inclusion of preview=1 when previewing a Validated URL serves any purpose. The fact that we want to preview changes to the validation error state is indicated by the presence of the validation_errors query param. Therefore, I believe that \AMP_Validation_Manager::override_validation_error_statuses() can be modified to remove the condition checking for isset( $_REQUEST['preview'] ):
In addition, clicking the Preview Changes button on the Validated URL screen needs to result in taking a user to the URL without the preview=1 query param:
Expected Behaviour
An AMP page should render with the same content whether previewing changes to the status of invalid markup or viewing the page on the frontend normally.
Steps to reproduce
Enable Sharing module in Jetpack.
Cause some validation error (e.g. via a script in a Custom HTML block)
Validate the URL
Toggle the status of the validation error from Removed to Kept.
Click the Preview Changes button
Notice the Sharing buttons are missing, when they are normally shown on an AMP page.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered:
Bug Description
Here's the scenario:
In #5356 I'm working on fixing #771 which involves catching better handling of validation errors caused by including
i-amphtml-
in a stylesheet (instead of this causing the entire stylesheet to be removed, only the bad selector should be removed). I was trying to add this to the stylesheet and then seeing the behavior of forcibly keeping the invalid CSS. But when I changed the status from Removed to Kept and clicked Preview, I did not see the CSS being kept on the page. What's going on?First of all, the validation error for a
style
element (currently) includes the full text of the element as one of the error properties (which probably shouldn't be done foramp-custom
oramp-keyframes
). Any change to the stylesheet causes a separate validation error to be created, since the validation error is identified by a hash of the error properties.Secondly, I have Jetpack active locally, and it is configured to display the sharing buttons on the page. And herein lies the problem: Jetpack's Sharing module is configured to not show anything if
is_preview()
returns true, and when clicking the Preview button on the Validated URL screen, the URL includes thepreview=1
query parameter. The result is different HTML is on the previewed page, and this results in different tree-shaken CSS, and thus different content for thestyle[amp-custom]
element. This is unexpected.In reality, I don't believe the inclusion of
preview=1
when previewing a Validated URL serves any purpose. The fact that we want to preview changes to the validation error state is indicated by the presence of thevalidation_errors
query param. Therefore, I believe that\AMP_Validation_Manager::override_validation_error_statuses()
can be modified to remove the condition checking forisset( $_REQUEST['preview'] )
:amp-wp/includes/validation/class-amp-validation-manager.php
Lines 492 to 493 in 8f11667
In addition, clicking the Preview Changes button on the Validated URL screen needs to result in taking a user to the URL without the
preview=1
query param:Expected Behaviour
An AMP page should render with the same content whether previewing changes to the status of invalid markup or viewing the page on the frontend normally.
Steps to reproduce
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: