-
Notifications
You must be signed in to change notification settings - Fork 382
Closed
Labels
BugSomething isn't workingSomething isn't working
Milestone
Description
Bug Description
The image entered during editing renders differently (erroneously) once published.
Expected Behaviour
Story should visually look the same in the editor and once published.
Steps to reproduce
- Add image block to page
- Preview/Publish
- Image block displays incorrectly
Screenshots
Additional context
- WordPress version:
- Plugin version: 1.3-rc
- Gutenberg plugin version (if applicable):
- AMP plugin template mode:
- PHP version:
- OS:
- Browser: [e.g. chrome, safari]
- Device: [e.g. iPhone6]
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- AC1: When creating stories in the editor, image within image blocks should display the same in the preview/publish view.
Implementation brief
- The issue of 0% displaying as 5% comes from PHP where
emptygives positive value for0, this causes using the default5as the value:
On 0% being displayed as 5%: yep,5is indeed the default value forpositionLeft. Looks like the issue comes from PHP where0is consideredempty:
amp-wp/includes/class-amp-story-post-type.php
Line 1534 in 5799032
$style['left'] = empty( $atts['positionLeft'] ) ? '5%' : $atts['positionLeft'] . '%';
We should replace using empty by something more reliable, perhaps with isset or strict equals for 0.
- The weird displaying of images due to
display:tablecan be fixed by overriding the value in the plugin'samp-stories-frontend.cssfile for.wp-block-image.is-resizedand other.wp-block-image.*values. See/gutenberg/packages/block-library/src/image/style.scssto check where thedisplay:tableis set. The value should bedisplay: blockinstead.
QA testing instructions
Test 1
- Add image block to the page
- Preview/Publish
- Verify that the block matches the view in the editor and in the FE (unlike on the screenshots above)
Test 2
- Add an image block to the Page
- Place the image exactly on the left border of the Page
- Verify that it displays on the border of the Page in the FE as well.
Demo
Changelog entry
- Improved rendering of images on the frontend to be more accurate
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working

