Issues

ZF-7003: Navigation_Menu view helper html render improvement

Description

Hi, The navigation menu render helper, render html (ul, li and a) elements for example:


Link A Link B

The renderer use the navigation page CSS class for element A, If we wana styling specific LI element with current configuration its very hard and must use CSS selectors etc.., It can be more easy to achieve if the navigation page CSS class styles the LI element not the A element like below


Link A Link B

Now its easy to refer to both li and a.

Thanks

Comments

So you want a boolean switch in the menu helper for enabling this behaviour (using page CSS classes for LI instead of A)?

There is no need to style the A element because you can easy style it by CSS2 selectors (.class a) which currently implement in all the browsers but for backward compatible it would be suitable.

I agree.

The only thing that bites me is that I remember there was a reason for styling the A (instead of the LI). That is to say, there was a reason for that design choice, but I can't remember it right now. Will look further into it.

If you are wondering: I've modified the Zend_View_Helper_Navigation_Menu so it sets the class on the list item element and not the anchor element. It works and doesn't show any defects. For me this isn't any issue, but I would prefer to see the sollution in the original Framework. Thanks.

I believe the design reason is absolute since CSS2.

I mean absolete, not absolute :) Sorry for that.

This would be a nice improvement indeed. Did you have the time to look into it Robin?

I've created a small patch for this. Maybe it helps someone, it just use the same class names for LI elements as for the anchors.

Robin, would it be possible to integrate the patch from Peter? Regarding CSS, we are able to target a child element from a given element:

 
LI.active A {
  /* my rules */
}

but not the opposite. At least, would it be possible to have an update on this issue?

For backward compatibility in the HTML output we need (for the moment) a boolean switch. In Version 2 we remove the switch and set the class to the list element. We also improve the whole rendering for all helpers and all elements (ul, li, a, span, …).

I have written some tests and the implementation. For the current major release, there will be a boolean switch.

Patch and unit tests added.

Applied patch to trunk (25112) and release-1.12 (25113)