Project

General

Profile

Actions

Bug #98121

closed

<typo3-backend-icon> does not reflect icon size when size is set via property instead of

Added by Helmut Hummel over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-08-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When using the custom element <typo3-backend-icon>
with a JS framework, that renders the DOM (e.g. Vue https://github.com/vuejs/core/issues/3738 https://github.com/vuejs/core/issues/3792),
it can happen, that they set the properties of the custom element
instead of an attribute.

Since Lit does not reflect these properties to attributes by default,
but the icon-element relies on CSS set on the host element that depends
on the size attribute, the icon is not rendered in the correct size.

See: https://web.dev/custom-elements-best-practices/
on why reflecting properties to attributes might be a good idea
in some cases.

To reproduce put the following in a Fluid template of a backend module (TYPO3 12/ main):

<f:be.pageRenderer includeJavaScriptModules="{0: '@typo3/backend/element/icon-element.js'}"/>
<div id="app" style="font-size: 8px"></div>
<script>
    let icon = document.createElement('typo3-backend-icon');
    icon.identifier = 'actions-search';
    icon.size = 'large';
    document.getElementById('app').appendChild(icon);
</script>

Expected:

Large icon

Actual:

Very small icon

For TYPO3 11, the page renderer VH is different:

<f:be.pageRenderer includeRequireJsModules="{0: 'TYPO3/CMS/Backend/Element/IconElement'}"/>

The rest is the same

Actions #1

Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75414

Actions #2

Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75414

Actions #3

Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75415

Actions #4

Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75414

Actions #5

Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75415

Actions #6

Updated by Helmut Hummel over 2 years ago

  • Description updated (diff)
Actions #7

Updated by Helmut Hummel over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF