Bug #97186
open
Menuprocessor shortcut active subpage wrong link state
Added by Marcel Macasso over 2 years ago.
Updated 7 months ago.
Description
It seems that there is a problem with the link state of shortcuts if the shortcut points to a subpage that is currently open in the browser.
We use the MenuProcessor for our breadcrumbs, and if I go to a subpage from a shortcut, and the shortcut links to this specific subpage, then both the shortcut as well as the subpage are getting the status "current". See attached screenshot.
I would expect that only the current page would get the state "current", and the parent shortcut page not.
Problem occurs in TYPO3 11.5.8
Files
Related issues
1 (1 open — 0 closed)
- Status changed from New to Needs Feedback
Hey Marcel,
yes, we've changed this recently (one could call it a regression, but I guess the current behaviour is more like it should behave in general). Let's use the naming differently: If you have a shortcut item in a menu, could this ever have a "current" status?
Also, can you share your TypoScript configuration?
Hi Benni,
sure, this is the TypoScript that is used:
#####################
#### BREADCRUMBS ####
#####################
page.10.dataProcessing {
40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
40 {
special = rootline
special.range = 0|-1
includeNotInMenu = {$page.navigation.breadcrumbNav.includeNotInMenu}
as = navigationBreadcrumb
if {
value = {$page.navigation.breadcrumbNav.enableLevel}
value {
insertData = 1
prioriCalc = 1
stdWrap.wrap = |-1
}
isGreaterThan {
data = level
}
}
}
}
As a workaround I added in Fluid a check that adds the "current" class only if the page in the iteration has the same uid as the current page I am on.
<f:if condition="{navigation_breadcrumb}">
<nav id="breadcrumbs">
<ol class="breadcrumbs">
<f:for each="{navigation_breadcrumb}" as="item">
<f:variable name="currentCssClass" value="" />
<f:if condition="{item.data.uid} == {pageUid}">
<f:variable name="currentCssClass" value=" current" />
</f:if>
<li class="{f:if(condition:item.active, then:' active')}{currentCssClass}">
<f:if condition="{currentCssClass} == false">
<f:then>
<span class="name">{item.title}</span>
</f:then>
<f:else>
<a href="{item.link}" title="{item.title}">
<span class="name">{item.title}</span>
</a>
</f:else>
</f:if>
</li>
</f:for>
</ol>
</nav>
</f:if>
But you are right. The question is if a shortcut item could ever have a current state. I guess not.
- Related to Bug #97037: Shortcut in menu to root page is always active added
- Status changed from Needs Feedback to New
Revert a6593bd949 to solve the issue.
Let's use the naming differently: If you have a shortcut item in a menu, could this ever have a "current" status?
No, it should not be active on its own.
If you want the shortcut to be active, you can easily set this by
[page["uid"] == xxx]
page.10.dataProcessing.10.alwaysActivePIDlist = yyy
[end]
This change breaks installations, where the content of the landing page is on the rootpage of the installation and there is a shortcut like "welcome" to this root page in the menu. This "welcome"-page is always active in current TYPO3 versions, no matter, what the real active page is.
Another workaround:
https://forge.typo3.org/issues/97037
https://forge.typo3.org/issues/97186
ORIGINAL: <f:else if="{item.active}"></f:else>
WORKAROUND: <f:else if="{item.active} && {item.data.doktype} !== 4"></f:else>
doktype 4 = shortcut page
Christian Hackl wrote in #note-8:
Another workaround:
[...]
This workaround sadly does not work if the current page is below another shortcut. This one should have the active state but the one leading to the current page not.
So I added this (using EXT:bootstrap_package) to mark only shortcuts not leading to a specific page:
{f:if(condition: '{item.active} && ({item.data.doktype} !== 4 || {item.data.shortcut_mode})', then:' active')}
Also available in: Atom
PDF