Issue Bug Closed

#98549SVG icons with no explicit height/width are not displayed under singleSelect fields

David Menzel 10/07/22, 17:30 updated 06/20/24, 07:23

Description

When you have a singleSelect in BE and add some SVGs as icon and the SVG has to explicit width or height, then no icon is shown under the select field, for example the Backenlayout icons or a custom singleSelect.

TCA

        'tx_rds_header_color' => [
            'exclude' => true,
            'label' => 'Farbe',
            'description' => 'Beschreibung',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'Standard',
                        'default'
                    ],
                    [
                        'cyan',
                        'cyan',
                        'EXT:my_ext/Resources/Public/Icons/Colors/21ACCD.svg'
                    ],
                    [
                        'schwarzblau',
                        'schwarzblau',
                        'EXT:my_ext/Resources/Public/Icons/Colors/5F7DA0.svg'
                    ],
                    [
                        'white',
                        'white',
                        'EXT:my_ext/Resources/Public/Icons/Colors/FFFFFF.svg'
                    ]
                ],
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],

SVG

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" style="fill:#5f7da0"/></svg>

Workaround: add height and width to SVG

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><rect width="24" height="24" style="fill:#5f7da0"/></svg>

better solution:
Set a min-height and min-width in CSS for the places where the icons should be shown, in case no dimension was set in the SVG

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.