User tests: Successful: Unsuccessful:
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.
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
Notice the extra edit buttons to the left of two of the menu items.

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
| Status | New | ⇒ | Pending |
| Category | ⇒ | Layout |
| Title |
|
||||||
| Labels |
Added:
PR-5.4-dev
|
||
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
Screenshot showing my texteditor matching item 34 with the regex for item 3

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.
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!
| Labels |
Added:
bug
|
||
@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.
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
| Status | Pending | ⇒ | Ready to Commit |
RTC
| Labels |
Added:
RTC
|
||
✅ Final test before merge with JBT
item-1 to see two edit buttons. And another one with item-11 to see three edit buttons 😄gh pr checkout 46569
| 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 |
Thank you @henrikdalgaard for your contribution. Thank you @brianteeman, @exlemor and @ThomasFinnern for testing.
@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 ?