question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Menu links not displaying router-link-active

See original GitHub issue
  • I confirm that this is an issue rather than a question.

Bug report

When using letters like Æ, Ø, Å in the menu text and menu links, the header active bottom border will not display. When using normal english characters in the text and links it works how it’s supposed to.

Steps to reproduce

Use letters like Æ, Ø or Å in the nav menu text.

What is expected?

The border-bottom router-link-active should display normally with the Æ, Ø, Å letters just like it does with normal text characters.

What is actually happening?

The router-link-active (bottom border) isn’t displaying when using weird characters.

Other relevant information

  • Output of npx vuepress info in my VuePress project:

Environment Info:

System: OS: Linux 5.2 Arch Linux undefined CPU: (8) x64 Intel® Core™ i7-4770K CPU @ 3.50GHz Binaries: Node: 11.15.0 - /usr/bin/node Yarn: 1.17.3 - /usr/bin/yarn npm: 6.10.2 - /usr/bin/npm Browsers: Chrome: Not Found Firefox: 68.0.1 npmPackages: @vuepress/core: Not Found @vuepress/theme-default: Not Found vuepress: Not Found npmGlobalPackages: vuepress: 1.0.2

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chris-vissercommented, Aug 7, 2019

Found a nice workaround for now @Mbensler .

You can use permalinks in your frontmatter. For example in your README.md:

---
permalink: /theÅme
---

This would put the permalink as the matcher for the url and it will become active. Unfortunatly only for exact matches so you will need to add it to every sub readme file:

---
permalink: /theÅme/someintro.md
---
1reaction
chris-vissercommented, Aug 7, 2019

I’ve found the issue and the fix. The issue is related to ./package/@vuepress/core/lib/node/Page.js. All scanned filepaths are ‘fixed’ with encodeURI meaning the special chars get converted to their encoded form. This doesnt happen with the link’s uri, that’s why it does show the correct file, but its not matching it for the link to make it an active state.

Here’s a snippet of that code:

    if (relative) {
      this.regularPath = encodeURI(fileToPath(relative))
    } else if (_path) {
      this.regularPath = encodeURI(_path)
    } else if (permalink) {
      this.regularPath = encodeURI(permalink)
    }

It could ofcourse be fixed by removing the encodeURI. However, there is a test explicitly checking if the paths are properly encoded, meaning that this might break existing dependants.

@ulivz To you have an idea of the impact that this change would bring? If it does have a breaking impact, I might add a PR with some config approach to make exceptions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

routerLinkActive not working for navigation bar - Stack Overflow
routerLinkActive only makes sense if you have a routerLink on the same element or one of its child. Your links does not use...
Read more >
RouterLinkActive - Angular
Tracks whether the linked route of an element is currently active, and allows you to specify one or more CSS classes to add...
Read more >
Styling Active Router Link in Angular - GeeksforGeeks
Create the header component that contains the navigation links. Then apply the “routerLinkActive” on each router link and provide the CSS class ...
Read more >
Side nav item not active on initial load
p>*_Expected behavior_*When adding routerLinkActive=active the class active is set on the item and should take the style of of an active link.
Read more >
Styling Links with routerLinkActive in Angular - Pluralsight
This differentiation can be achieved by showing the active link in a ... Click on the File menu in the top menu bar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found