Project

General

Profile

Actions

Bug #102796

closed

f:image would not add alt-text in alt-attribute of img-tag

Added by Dieter Dr. Porth 11 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Fluid
Target version:
-
Start date:
2024-01-09
Due date:
% Done:

0%

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

Description

The f:image Viewhelper disallow content in the alt-attribute.
Current Version TYPO3 11.5.33

See patch


Files

local_history1.patch (1.33 KB) local_history1.patch Dieter Dr. Porth, 2024-01-09 10:33
Actions #1

Updated by Oliver Bartsch 11 months ago

  • Status changed from New to Needs Feedback

Hi,

actually I'm a bit confused. Did you experience this bug or is this report just on the VH's code? Because ImageViewHelper extends the AbstractTagBasedViewHelper, which automatically adds all tag attributes, having a value set, see https://github.com/TYPO3/Fluid/blob/aa81073b0b5938916d8e0c83af7ca28600742053/src/Core/ViewHelper/AbstractTagBasedViewHelper.php#L123.

Additionally there were some adjustments done recently, which allow to also use empty alt attributes, see #102739.

Could you please check, whether this bug really exists in current main?

Best, Oli

Actions #2

Updated by Dieter Dr. Porth 11 months ago

sorry for my missleading headline.
The image-viewhelper add everytime an empty(!) alt-attribute to the img-tag.
The if-condition is wrong and make thing going south. (see patch)

            // The alt-attribute is mandatory to have valid html-code, therefore add it even if it is empty
            if (empty($this->arguments['alt'])) {
                $this->tag->addAttribute('alt', $image->hasProperty('alternative') ? $image->getProperty('alternative') : '');
            }
Actions #3

Updated by Stefan Bürk 10 months ago

The condition is correct. However, the code in the conditin block is wrong and may add a empty string if therr is also no alt description for the image.

Empty alt description attribute ahould be completly removed if empty.

Actions #4

Updated by Stefan Bürk 10 months ago

  • Assignee set to Stefan Bürk
Actions #5

Updated by Dieter Dr. Porth 10 months ago

Thanks for the feedback and sorry for the stolen time. You are right.
Please close this embarrassing ticket as quickly as possible. I had read something completely wrong.

Actions #6

Updated by Stefan Bürk 10 months ago

  • Status changed from Needs Feedback to Closed

Please close this embarrassing ticket as quickly as possible. I had read something completely wrong.

Closing this issue than as requested. If needed, it can be reopened if additional information occures.

Actions

Also available in: Atom PDF