Project

General

Profile

Actions

Bug #97186

open

Menuprocessor shortcut active subpage wrong link state

Added by Marcel Macasso about 2 years ago. Updated 2 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Pagetree
Target version:
-
Start date:
2022-03-15
Due date:
% Done:

0%

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

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

screenshot-menuprocessor.png (69.9 KB) screenshot-menuprocessor.png Marcel Macasso, 2022-03-15 10:35

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #97037: Shortcut in menu to root page is always active New2022-02-25

Actions
Actions #1

Updated by Benni Mack about 2 years ago

  • 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?

Actions #2

Updated by Marcel Macasso about 2 years ago

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.

Actions #3

Updated by Riccardo De Contardi about 2 years ago

is this related? #97037

Actions #4

Updated by Marcel Macasso about 2 years ago

  • Related to Bug #97037: Shortcut in menu to root page is always active added
Actions #5

Updated by Riccardo De Contardi over 1 year ago

  • Status changed from Needs Feedback to New
Actions #6

Updated by Dmitry Dulepov over 1 year ago

Revert a6593bd949 to solve the issue.

Actions #7

Updated by Christian Welzel over 1 year ago

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.

Actions #8

Updated by Christian Hackl about 1 year ago

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
Actions #9

Updated by Uwe Wiebach 2 days ago

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')}

Actions

Also available in: Atom PDF