Cap icon height to prevent monstruous outcomes

Created on 22 November 2022, over 2 years ago
Updated 6 June 2023, almost 2 years ago

Problem/Motivation

When a user uploads an icon for a button, especially if it is an SVG without explicit width/height or with big width/height attributes, the lack of a size limit might break the design of the table.

Note that uploading SVGs is something that might become more and more common as CKE5 will force us to only accept SVGs πŸ“Œ When CKEditor5 is installed, only allow SVGs for button icons Fixed .

Steps to reproduce

- Upload a SVG without widht/height attributes or with a big value. Examples used for testing, obtained from a popular SVG icon library.

<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" fill="#000000" viewBox="0 0 256 256"></svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="#000000" viewBox="0 0 256 256"></svg>

- The table will suffer as the <img> will be sized by the SVG attributes (or lack of them) and the icon will be completely out of proportion.

Without explicit attributes:

With large atribute values (600px), something not so unusual when getting SVG files.

Proposed resolution

Cap the heigth of the image, using max-height to avoid enlarging of smaller icons while keeping larger icons controlled.

For example, using max-height: 2rem results on this:

The first icon is a big svg capped at 2rem, the other icons are smaller pngs that don't get enlarged.

✨ Feature request
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024