Linking breaks responsive image formats
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3197132. --> Reported by: [sambc](https://www.drupal.org/user/1287974) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Working with Drupal 9, I'm making a 'preview' for a custom content type that provides an image (using the core Media module) with a caption and next/previous links. The preview display is intended to be embedded in other nodes. I want to make the image a link to the image page itself.</p> <p>This all works fine, unless the image is being displayed with a responsive image format. In that case, the sizes attribute gets truncated, to only the portion after the <em>last</em> min-width media selector, completely breaking the whole responsive image specification. I suspect that it's actually the colon after the min-width that is the problem, as that seems to be a more likely target for munging than the string 'min-width:' as a whole.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>I haven't tried a minimum reproduction, but if I'm right this should happen literally any time you use this module to wrap an image that has a responsive image style selected.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>I've reviewed the code that does this, which appears to be the same in 8.x-1.3 and in 8.x-dev, which isn't surprising given the commit history, and I cannot see anywhere in this module's code that this would be happening.</p> <p>In fact, the module doesn't appear to treat any attributes differently from one another on an img tag, and yet I can't reproduce the problem with the alt attribute. So frankly, I'm confused.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3> > Related issue: [Issue #2319165](https://www.drupal.org/node/2319165)
issue