Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292243

Image resize with precent makes figcaption expand to width of container

$
0
0

Problem/Motivation

In ckeditor5 the resizeImage is using '%' now and before it was 'px'. This causes the <figcaption> element to push the container box and not match the image width.

Steps to reproduce

MVC: https://jsfiddle.net/jhuzk2tm/

Screenshot for posterity:
Screenshot of Fiddle MVC

<figure class="caption caption-img align-left">
    <img alt="Broken with %" src="https://placehold.co/6000x4000" width="46.52%" height="400">
    <figcaption>Align left and wrap text - Broken!</figcaption>
</figure>
<figure class="caption caption-img align-left">
    <img alt="Works with px" src="https://placehold.co/6000x4000" width="400px" height="400">
    <figcaption>Align left and wrap text - Works!</figcaption>
</figure>

<style>
/* Responsive */
img {
  max-width: 100%;
  height: auto;
}
/* Color to demo */
figure {
  background: pink;
}
figcaption {
  background: hotpink;
  padding: 5px;
}

/**
 * @file
 * Alignment classes for text and block level elements.
 */
/**
 * Alignment classes for block level elements (images, videos, blockquotes, etc.)
 */
.align-left {
  float: left;
}

/**
 * @file
 * Caption filter: default styling for displaying image captions.
 */

/**
 * Essentials, based on http://stackoverflow.com/a/13363408.
 */
.caption {
  display: table;
}
.caption > * {
  display: block;
  max-width: 100%;
}
.caption > figcaption {
  display: table-caption;
  max-width: none;
  caption-side: bottom;
}

</style>

Proposed resolution

Change resizeImage to 'px' or open to suggestions.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 292243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>