[MAGNOLIA-2072] Add ability for SimpleNavigation to set an ID on the anchortag that it creates Created: 22/Feb/08  Updated: 04/Nov/15  Resolved: 04/Nov/15

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 3.5.4
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Ryan Gardner Assignee: Fabrizio Giustina
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File Adding_anchor_element_to_simpleNavigationTag.patch    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

For certain javascript uses, it becomes trivial to add functionality to an anchor if it has a known ID applied to it.

Here is a snippet of some simple prototype-based javascript code that relies on the anchor having a known ID, and other elements having known ID's that are set based on the pageName:

Having an ID makes it possible to find the element almost instantly. Assigning the IDs in the jsp with the el makes it very simple to maintain the connection between the javascript and the page elements.

Event.observe('${childPages.name}', 'mouseover', function(event) {
$$('.${navigationStyles}').invoke('removeClassName', 'active').invoke('addClassName', 'hidden');
$('${childPages.name}_navItems').addClassName('${visibleMenuState}');
$('${childPages.name}_navItems').removeClassName('hidden');

The use case this was created for was that I built a two-level tab navigation panel... and needed a way for the tabs to swap out the content of the second-level that was below it. (Doing it via CSS would be possible, but undesireable for the simple fact that the smaller navigation below it is relatively thin, and using a CSS:hover attribute causes the rollover to cease the second you leave the element... using javascript allows you to use a small timeout before hiding the rollover - plus - it's easier to build it in javascript if you have tag liibraries and the EL doing the heavy lifting for you )

Currently, the only option for setting the ID is specifying it to be "pageName" - like this:

<cmsu:simpleNavigation startLevel="0" endLevel="1" wrapperElement="span" anchorTextID="pageName"/>

If other unique ID-naming schemes were desired, they could be added in the future with relative ease.



 Comments   
Comment by Magnolia International [ 19/Jan/09 ]

Hmm, this has been opened for a while without any feedback. It seems to me a little over-complex. Maybe redoing the patch file against the latest trunk, without any code-style related changes would make it clearer. Maybe it's too flexible - do we really need different naming schemes ? (i'd say "no" until we don't have a concrete use-case and implementation)

Comment by Michael Mühlebach [ 04/Nov/15 ]

Given the thousands of other issues we have open that are more highly requested, we won't be able to address this issue in the foreseeable future. Instead we will focus on issues with a higher impact, and more votes.
Thanks for taking the time to raise this issue. As you are no doubt aware this issue has been on our backlog for some time now with very little movement.
I'm going to close this to set expectations so the issue doesn't stay open for years with few updates. If the issue is still relevant please feel free to reopen it or create a new issue.

Generated at Mon Feb 12 03:33:08 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.