Automattic / Automattic/jetpack

Recipe Shortcode: Images added to shortcode are displayed too large

Open
#30,948 2 comments 0 reactions 0 assignees View on GitHub
[Feature] Shortcodes / Embeds [Platform] Atomic [Platform] Simple [Plugin] Jetpack [Pri] Low [Status] Stale Bug Customer Report [LEGACY] Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Quick summary

When adding the recipe shortcode to a post or page, images added to the shortcode (per instructions [here](https://wordpress.com/support/recipes/)) are not rendered correctly. Instead of being properly sized for the content column they appear overlarge and cannot be seen without scrolling to the right.

### Steps to reproduce

1. create test post/page on your site
2. add the recipe shortcode to either the Shortcode Block or the Classic Block (a sample shortcode [can be found here](https://wordpress.com/support/recipes/#example-of-a-complete-recipe))
3. publish page

### What you expected to happen

Image is properly sized to fit within the content column.

### What actually happened

Image appears to be shown at full resolution, regardless of them layout, and runs offscreen to the right.

### Impact

Some (< 50%)

### Available workarounds?

Yes, difficult to implement

### Platform (Simple and/or Atomic)

Simple

### Logs or notes

This appears to be specific to newer themes, which do not have the correct styles in place for image sizing. Tested the following themes which all appear to have this sizing issue
- TT3
- TT2
- Blank Canvas

In my tests the shortcode image is rendered correctly in classic themes. I tried the following:
- TT1
- Hever

Screenshot:
Screen Shot 2023-05-24 at 1 16 22 PM

For affected themes, adding the following as custom CSS seems to resolve the issue:

```
.wp-block-post-content img {
max-width: 100%
}
```

Other workarounds could include using blocks or a block pattern, or switching to a theme that supports the shortcode.

Contributor guide

Open the contributing guide

Research direction

Reproduce the recipe shortcode in a test post or page using the Shortcode Block or Classic Block, especially with TT3, TT2, or Blank Canvas. Compare the rendered image sizing with classic themes and inspect the affected theme styling; done means shortcode images fit within the content column without horizontal overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.