markbind icon indicating copy to clipboard operation
markbind copied to clipboard

topNav highlighting is unintuitive and not documented enough

Open damithc opened this issue 3 years ago • 4 comments

When you visit https://nus-cs2103-ay2122s2.github.io/website/ the wrong item is highlighted in the topNav. Expected: nothing should be highlighted.

image

It works correctly for the other pages though. Possibly specific to the above site.

damithc avatar Feb 02 '22 08:02 damithc

This may be expected as the links are siblings of each other https://raw.githubusercontent.com/nus-cs2103-AY2122S1/website/master/_markbind/layouts/header.md

https://markbind.org/userGuide/components/navigation.html#navbars You'll likely need to specify a mix of the highlight-on / default-highlight-on attributes to avoid this case.

The rationale for highlighting siblings links by default is the common use case of:

  • some link in the navbar points to a xx/index.html (should be highlighted)
  • the user is currently at xx/yy.html

Edit: I misread the link, this might be a bug 🤔

ang-zeyu avatar Feb 02 '22 08:02 ang-zeyu

On second look this seems to be the issue discussed with @jonahtanjz in https://github.com/MarkBind/markbind/pull/1700#discussion_r776168029.

There is some ambiguity on how servers treat links like these .../dashboard:

  • dashboard.html (we are currently following this)
  • dashboard/index.html

Following the first interpretation, since https://nus-cs2103-ay2122s2.github.io/website/index.html is a child of https://nus-cs2103-ay2122s2.github.io/dashboard.html the link is highlighted.

In reality both of these interpretations are valid in most static file servers.

We could do checks for both interpretations, but this also risks introducing false positives due to the ambiguity.

Wonder if we should settle with puting up a note in the user guide about how these links are interpreted inside our highlighting, and advise toward more explicit links. (e.g. xx/ or xx/yy.html form of links)

ang-zeyu avatar Feb 02 '22 09:02 ang-zeyu

Thanks @ang-zeyu for investigating this. Confirmed it's working after I added a trailing / i.e., .../dashboard/ instead of .../dashboard

damithc avatar Feb 02 '22 10:02 damithc

Similar issue mentioned recently in #2072 and #2400 ; while not buggy behaviour it would be good to have this documented since it has come up a few times.

kaixin-hc avatar Apr 15 '24 16:04 kaixin-hc