Issue Bug Closed

#97186Menuprocessor shortcut active subpage wrong link state

Marcel Macasso 03/15/22, 10:37 updated 12/02/25, 14:33

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

Reviews 2

Files 1

History 1315

  1. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2022-03-15T14:58:06+00:00" > 03/15/22, 14:58 </span>

    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?

  2. Marcel Macasso commented <span data-processor="relativetime" data-value="2022-03-15T15:17:39+00:00" > 03/15/22, 15:17 </span>

    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.

  3. Christian Welzel commented <span data-processor="relativetime" data-value="2022-11-08T14:43:39+00:00" > 11/08/22, 14:43 </span>

    > 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.

  4. Christian Hackl commented <span data-processor="relativetime" data-value="2023-04-24T10:29:34+00:00" > 04/24/23, 10:29 </span>

    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
  5. Uwe Wiebach commented <span data-processor="relativetime" data-value="2024-05-02T15:53:05+00:00" > 05/02/24, 15:53 </span>

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

  6. Oliver Eglseder commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-03-25T13:00:09+00:00" > 03/25/25, 13:00 </span>

    Applied in changeset commit:09677caddf8dc5151151921d30059cd9c8ae8743.