trys / sergey

A tiny lil' static site generator
https://sergey.trysmudford.com
MIT License
301 stars 39 forks source link

Sergey-link active class on two different links #49

Open theedigerati opened 4 years ago

theedigerati commented 4 years ago

When I click the navigation link to blog page, the active class is still on the e-commerce navigation link which is the index page link. `Blog

School E-commerce

`

nevanscott commented 4 years ago

Is aria-current="page" only showing on the Blog link? If so then it’s currently working as intended, and you could change the way that link looks using an attribute selector in your CSS, something like:

[aria-current="page"] {
    font-weight: bold;
}

Does this cover your use case?

If so, perhaps the documentation could be more explicit about how this works.

If not, I’d be willing to discuss other ways this feature could work to be more fitting to expectations and needs.

(Note: as designed, the active class is added also to parent links, as a way to also allow styling of more complicated nested navigation structures.)

theedigerati commented 4 years ago

Yeah thanks a lot. I initially was styling the active link based on the active class. It'll be better to style based on the aria-current attribute. Though the active class still shows on two different links which are siblings and that shouldn't be. What I did was use JS to remove the active class from the links that do not have the aria-current attribute and it solved my problem because other interactions as well were dependent on the link with an active class.