Issue Feature New Orphaned

#107090f:link.typolink removes entire tag when no valid link target can be generated, causing CSS class loss

Felix Ranesberger 07/14/25, 08:28 updated 08/08/25, 17:46

Description

The <f:link></f:link> ViewHelper completely removes the entire link tag when it cannot generate a valid link target (e.g., when linking to a hidden page). This behavior causes CSS classes and other attributes to be lost, potentially breaking the layout and styling of frontend elements.

<!-- Input -->
<f:link.typolink class="test" parameter="{linkToHiddenPage}">
   <span>Link Text</span>
</f:link.typolink>

<!-- Output when page is hidden or inaccessible -->
<!-- Only slot content is rendered - entire link is removed -->
<span>Link Text</span>

Impact

  • Layout breaks: CSS styling fails when expected classes are missing
  • Unpredictable behavior: Works in 99% of cases but fails when pages are hidden/inaccessible
  • Manual workarounds required: Developers need to implement explicit condition checks

*Possible solution:*
Render an tag with a placeholder href.
This causes CSS styling like “a.test” to be valid and simply replaces the incorrect link with a “#” placeholder.

<a href="#" class="test">
   <span>Link Text</span>
</a>

Reviews 0

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

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[FEATURE] f:link.typolink removes entire tag when no valid link target can be generated, causing CSS class loss Resolves: #107090 Releases: main