#102796f:image would not add alt-text in alt-attribute of img-tag
Description
The f:image Viewhelper disallow content in the alt-attribute.
Current Version TYPO3 11.5.33
See patch
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Files 1
History 6
-
Oliver Bartsch commented and changed status
NewNeeds Feedback 01/10/24, 14:37 -
Dieter Dr. Porth commented 01/10/24, 15:11
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') : ''); } -
Stefan Bürk commented 01/13/24, 10:47
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.
-
Stefan Bürk changed assigned to Stefan Bürk 01/13/24, 10:48
-
Dieter Dr. Porth commented 01/15/24, 07:28
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. -
Stefan Bürk commented and changed status
Needs FeedbackClosed 01/15/24, 23:36> 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.
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