No Code Attached Yet
avatar stonebyter
stonebyter
20 Apr 2024

Steps to reproduce the issue

Add an article 'Music' with two divs that should be navigable with an in-page
anchor <div id="video"> and <div="audio">.

Build a menu hierarchy:
[Music] URL: index.php?option=com_content&view=article&id=6
-- [Videos] URL: index.php?option=com_content&view=article&id=6#videos
-- [Audio]. URL: index.php?option=com_content&view=article&id=6#audio

Expected result

When selecting one of the submenus [Videos] or [Audio] the browser should
scroll down to the <div> associated with the menu item.

Actual result

The top of the page is displayed. The browser does not scroll down.

The cause of the problem is, that two itemIds are added to the link.
The menu link created/enhanced by Joomla looks as follows:
index.php?option=com_content&view=article&id=6&itemId=130#videos&itemId=199

If I manually correct the link and put #videos at the end it works:
index.php?option=com_content&view=article&id=6&itemId=130&itemId=199#videos

System information (as much as possible)

Einstellung Wert
PHP erstellt für MacBookPro 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64
Datenbanktyp mysql
Datenbankversion 10.4.27-MariaDB
Datenbankzeichensatz utf8mb4_general_ci
Datenbankverbindungszeichensatz utf8mb4_general_ci
Datenbankverbindungsverschlüsselung Keine
Datenbankserver unterstützt Verbindungsverschlüsselung Nein
PHP-Version 8.2.0
Webserver Apache/2.4.54 (Unix) OpenSSL/1.1.1s PHP/8.2.0 mod_perl/2.0.12 Perl/v5.34.1
PHP-Interface für den Webserver apache2handler
Joomla-Version Joomla! 5.1.0 Stable [ Kudumisha ] 16-April-2024 16:00 GMT
Joomla Abwärtskompatibilität Plugin Aktiviert ()
Browsererkennung Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Additional comments

avatar stonebyter stonebyter - open - 20 Apr 2024
avatar stonebyter stonebyter - change - 20 Apr 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 20 Apr 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Apr 2024
avatar stonebyter stonebyter - change - 20 Apr 2024
The description was changed
avatar stonebyter stonebyter - edited - 20 Apr 2024
avatar stonebyter stonebyter - change - 20 Apr 2024
The description was changed
avatar stonebyter stonebyter - edited - 20 Apr 2024
avatar brianteeman
brianteeman - comment - 20 Apr 2024

This is not a joomla bug!!

The problem is that you are not creating the anchors correctly in your content

<div="audio"> is not valid html it must be <div id="audio">

avatar brianteeman
brianteeman - comment - 20 Apr 2024

Joomla will never create a url like the one you suggest it does as it has two itemid

index.php?option=com_content&view=article&id=6&itemId=130#videos&itemId=199

avatar stonebyter
stonebyter - comment - 20 Apr 2024

Sorry this was a typo. The div's on my page are correct, the same as you wrote <div id="audio">.

Hmm regarding the URL: I suppose the itemId=130 is the top menu (Music) and the itemId=199 is the submenu (Video). When I check the link, there are really two itemId's and unfortunately the second one (199) is behind the #video for some reasons. The two itemId's are added by Joomla (or maybe by a plugin). I guess it is to track the the menu where the page was called from. In the menu is just the URL index.php?option=com_content&view=article&id=6#videos. From my point of view, the additional itemId's are created by Joomla. I have no idea what else could modify the link...

avatar brianteeman
brianteeman - comment - 20 Apr 2024

Sorry!!!!!

You are quite correct - thats a new bug as it should not work like that at all

avatar brianteeman
brianteeman - comment - 20 Apr 2024

What you can do (and I tested myself this time) is to use the sef url instead of the non-sef url.

image

image

anchor

avatar stonebyter
stonebyter - comment - 21 Apr 2024

Thanks a lot for your help! I really do appreciate your work!

avatar gwstyles
gwstyles - comment - 21 Apr 2024

In Brian's last post there are 3 links that when clicked on just go to a blank page with "private user image". What is the point if you can't see them?


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

avatar brianteeman
brianteeman - comment - 21 Apr 2024

@gwstyles thats a limitation of the issues.joomla.org site. If you view it on github itself then you ccan see them - which obviously @stonebyter did #43324

avatar gwstyles
gwstyles - comment - 21 Apr 2024

Thank you Brian.


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

avatar Hackwar
Hackwar - comment - 5 Aug 2024

There are several things here at play. In this exact case, the solution is indeed to work with the SEF URL. However there is a bug in mod_menu where it should properly parse the URL and then add the Item ID to the query part instead of doing a simple string concatenation. For performance reasons we might want to check for a hash sign before we take the effort of running the URI class.

Add a Comment

Login with GitHub to post a comment