Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu link URL to an in-page anchor ( ...#some-id) not working from a submenu #43324

Open
stonebyter opened this issue Apr 20, 2024 · 9 comments

Comments

@stonebyter
Copy link

stonebyter commented Apr 20, 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

@brianteeman
Copy link
Contributor

brianteeman commented Apr 20, 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">

@brianteeman
Copy link
Contributor

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

@stonebyter
Copy link
Author

stonebyter commented Apr 20, 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...

@brianteeman
Copy link
Contributor

Sorry!!!!!

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

@brianteeman
Copy link
Contributor

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

@stonebyter
Copy link
Author

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

@gwstyles
Copy link

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.

@brianteeman
Copy link
Contributor

@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

@gwstyles
Copy link

Thank you Brian.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants