The discussion revolves around a bug where the active class is incorrectly applied twice to <a> elements in nav-pills for pages like about, faqs, and tos, while the parent <li> elements lack the class—causing styling issues in themes. scottrepreneur notes that <li> elements in topic lists are correctly classed as active, suggesting this was the intended behavior for nav-pills too. sam clarifies that Discourse never officially supported active on <li> elements and points out that the current link-to helper only auto-applies classes to <a> elements based on route. awesomerobot recalls that active was previously inconsistently applied to both <li> and <a> elements and was later centralized on <a> for consistency, though acknowledges placing it on <li> is acceptable if implemented properly. scottrepreneur asks if CSS can target the parent <li> based on the child <a>’s class, but awesomerobot confirms CSS lacks parent selectors, meaning a new component would be required to achieve this behavior. The consensus is that while useful for theming, implementing active on <li> elements would require architectural changes and is not currently supported.
It looks like there’s a small bug in setting the active class on the nav-pills for about, faqs, tos, etc. The active class is being properly set for the child link <a />, but being added to the element twice and lacking on the parent <li />.
I am not sure we ever supported an “active” class on the LI elements on nav-pills. I am not against adding this support for themes cause it seems like it could be useful. That said a bunch of stuff would need refactoring.
@techAPJ I think you moved this around, is there a reason for this “active” class? Seems like an error to me?
As to the bigger discussion of adding “active” class to LIs based on route, will leave it to @eviltrout and @awesomerobot. At the moment we use “link-to” which only gives us automatic support for route based classes on the A element. We would likely need a new component here.
At one point we did have an active state on some of the li elements across all the nav-pills, and in some other places we had active on the a elements…
As I recall I wanted to make things more consistent so I moved the active class to a everywhere? Putting it on the li instead is totally fine, but I think @sam is right and I went with putting it on a because there wasn’t a simple way to put it on all the lis instad…