RTC bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar henrikdalgaard
henrikdalgaard
13 Dec 2025

Pull Request for Issue #46566

Summary of Changes

The regex search and replace for menu items finds too many matches as the regex is not limited to one li tag. This results in extra edit links getting added. See screen shots.
An extra space is added to after the inserted edit link as it looks bad if flush against the menu item.
Tabs replaced with spaces in the same line.

Testing Instructions

Enable frontend editing on a page with a menu with lots of items.

Example buggy html output with fixed html
mod-menu1-buggy.html
mod-menu1-fixed.html

Actual result BEFORE applying this Pull Request

Notice the extra edit buttons to the left of two of the menu items.
buggy-menu

Expected result AFTER applying this Pull Request

fixed-menu

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar henrikdalgaard henrikdalgaard - open - 13 Dec 2025
avatar henrikdalgaard henrikdalgaard - change - 13 Dec 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Dec 2025
Category Layout
avatar tecpromotion tecpromotion - change - 13 Dec 2025
Title
Tightened regex searching for menu items to prevent duplicate edit link icons #46567
[5.4] Tightened regex searching for menu items to prevent duplicate edit link icons #46567
avatar tecpromotion tecpromotion - edited - 13 Dec 2025
avatar tecpromotion tecpromotion - change - 13 Dec 2025
The description was changed
avatar tecpromotion tecpromotion - edited - 13 Dec 2025
avatar tecpromotion tecpromotion - change - 13 Dec 2025
The description was changed
avatar tecpromotion tecpromotion - edited - 13 Dec 2025
avatar richard67 richard67 - change - 13 Dec 2025
Labels Added: PR-5.4-dev
avatar exlemor
exlemor - comment - 13 Dec 2025

@henrikdalgaard - sadly, I have not been able to reproduce the BEFORE condition - I set a side menu Main Menu - GB with 15+ items some with sub-menu and another Test Menu with itself 15 items and neither show double Pencil Checkbox ;(

(I had to go into Global Configuration and update the Frontend Editing field/option to Modules & Menu (you may wish to add that to the Testing Instructions))

( I wonder what other/additional condition is causing/creating the double icon ?

avatar brianteeman
brianteeman - comment - 13 Dec 2025

I cant replicate the reported problem so cant validate the proposed fix

image
avatar henrikdalgaard
henrikdalgaard - comment - 19 Dec 2025

I have debugged it further.

To provoke the bug, I have menu items 31, 32, 33, 34, 35 and then 3 in the same menu.
3 is a prefix to some of the other item numbers.
The items not containing 3 are not affected.

The regex '/(<li.?\bitem-' . $menuItemid . '.?>)/' becomes '/(<li.?\bitem-3.?>)/' which will match

  • - basically all menu items beginning with 3.

    Screenshot showing my texteditor matching item 34 with the regex for item 3
    Matching menu item 34

    With the fixed regex, only menu item 3 is matched when searching for menu item 3.

    Here is the $moduleHtml before the links are added.

    Menu-without-editing-links.html

    and $moduleHtml after the links are added
    Menu-after-editing-links-added.html

    I notice that before adding the links, the entire menu is in a 3000 character wide line.

  • avatar exlemor exlemor - test_item - 21 Dec 2025 - Tested successfully
    avatar exlemor
    exlemor - comment - 21 Dec 2025

    I have tested this item ✅ successfully on 4c5993d

    Hello @henrikdalgaard, thank you for your contribution and I have been able to successfully match the BEFORE and AFTER conditions now. It is now fixed.

    (For other testers, I did have to edit the database to recreate the situation needed (my IDs were in the 130's and I had to update an entry that wasn't a duplicate to 13 to make the condition appear)

    To make sure that this worked with more complex menu/sub-menu structures, I also created deeper structures than your example:

    Home
     - Test link for PR46569
     - Test Link 2 for PR46569
     - Test link 3 for PR46569
     - Test Link (13) for PR46569
    

    and 3 levels deep

     Home
     - Test link for PR46569
     -- Test of Sub-subcategories for PR46569
     --- Test Link 2 for PR46569
     --- Test link 3 for PR46569
     --- Test Link (13) for PR46569
    

    Happy Holidays!


    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46569.

    avatar henrikdalgaard henrikdalgaard - change - 23 Dec 2025
    Labels Added: bug
    avatar richard67
    richard67 - comment - 23 Dec 2025

    @henrikdalgaard There is no need to update the PR to changes in the base branch as long as there are no conflicts shown on GitHub. Now with your branch update you have invalidated the human test count, so I have to manually add back @exlemor 's successful test. This causes additional work for me.

    avatar richard67 richard67 - alter_testresult - 23 Dec 2025 - exlemor: Tested successfully
    avatar ThomasFinnern ThomasFinnern - test_item - 2 Jan 2026 - Tested successfully
    avatar ThomasFinnern
    ThomasFinnern - comment - 2 Jan 2026

    I have tested this item ✅ successfully on 5103a73

    Needed: switch on Global Configuration (System > Global Config > Site > Frontend Editing: Set to "Modules & Menus"

    Created nested menu items. Problem seen before applying the PR.
    After applying the PR by patch tester the double "edit" icons were gone.
    Tested edit icons of not nested menu link and two nested links were working
    Tested deeper nested items successfully


    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46569.
    avatar richard67 richard67 - change - 2 Jan 2026
    Status Pending Ready to Commit
    avatar richard67
    richard67 - comment - 2 Jan 2026

    RTC


    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46569.

    avatar muhme muhme - change - 8 Jan 2026
    Labels Added: RTC
    avatar muhme
    muhme - comment - 8 Jan 2026

    ✅ Final test before merge with JBT

    • Seen missing space and double/trippled edit buttons before PR
      • Note, it was importand for me to understand the problem is the item ID, as my menu item IDs are 100 and above, the problem is easy to force by one of the entries with menu item title item-1 to see two edit buttons. And another one with item-11 to see three edit buttons 😄
    • Applied PR with gh pr checkout 46569
      • Seen doubled/tripled edit buttons are fixed
      • Space is inserted between edit button and title
      • Menu item edit links are working and menu links are working
    avatar muhme muhme - change - 8 Jan 2026
    Status Ready to Commit Fixed in Code Base
    Closed_Date 0000-00-00 00:00:00 2026-01-08 17:39:16
    Closed_By muhme
    avatar muhme muhme - close - 8 Jan 2026
    avatar muhme muhme - merge - 8 Jan 2026
    avatar muhme
    muhme - comment - 8 Jan 2026

    Thank you @henrikdalgaard for your contribution. Thank you @brianteeman, @exlemor and @ThomasFinnern for testing.

    Add a Comment

    Login with GitHub to post a comment