Issue Bug Closed

#108506f:image ViewHelper ignores explicitly set title attribute when FAL metadata has title

Wolfgang Klinger 12/17/25, 14:58 updated 03/31/26, 08:59

Description

The f:image ViewHelper does not allow overwriting or removing the title attribute when the FAL file has a title set in metadata.
The title attribute is usually counterproductive for accessibility.

Current behavior

The condition empty($this->additionalArguments['title']) only checks if the argument is empty/not set. If a developer explicitly passes additionalAttributes="{title: ''}" to remove the title, the FAL metadata title is still rendered.

Expected behavior

  • additionalAttributes="{title: 'Custom'}" should output title="Custom"
  • additionalAttributes="{title: ''}" should output no title attribute
  • No title passed: should fall back to FAL metadata

Steps to reproduce

  1. Upload an image with title metadata set (e.g., “Original Title”)
  2. Use <f:image image="{image}" additionalAttributes="{title: ''}" />
  3. Rendered img tag still contains title="Original Title"

Suggested fix

Align with the existing alt attribute handling pattern:

if (isset($this->additionalArguments['title']) && $this->additionalArguments['title'] === '') {
    // In case the "title" attribute is explicitly set to an empty string, respect
    // this to allow excluding it from output intentionally.
} elseif (!isset($this->additionalArguments['title'])) {
    $title = trim((string)($image->hasProperty('title') ? $image->getProperty('title') : ''));
    if ($title !== '') {
        $this->tag->addAttribute('title', $title);
    }
}

Reviews 2

History 37

  1. Richard Krikler commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-02-06T16:45:09+00:00" > 02/06/26, 16:45 </span>

    Applied in changeset commit:f50a001581aaf4935a6966895f15445feffcb29b.