Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active links - adding 'selected' class not working #991

Open
mihau1 opened this issue Dec 1, 2020 · 2 comments
Open

Active links - adding 'selected' class not working #991

mihau1 opened this issue Dec 1, 2020 · 2 comments

Comments

@mihau1
Copy link

mihau1 commented Dec 1, 2020

If we are on some page the selected-current-link in menu should have "selected" class
but it doesn't work

$this->Menus->menu('main', [
   'dropdown' => true,
   'selected' => 'selected',
   'dropdownClass' => 'navbar-nav ml-auto',
   'subTagAttributes' => [
       'class' => 'nav-item',
   ],
   'linkAttributes' => [
      'class' => 'nav-link js-scroll-trigger',
   ],
]);
@mihau1
Copy link
Author

mihau1 commented Dec 1, 2020

If I change - MenusHelper line: 293

if (Router::url($link->link->getUrl()) == Router::url('/' . $currentUrl)) {

to

if (Router::url($link->link->getUrl()) == Router::url($currentUrl)) {

it works

System: "Windows 10"

@rchavik
Copy link
Member

rchavik commented Feb 2, 2021

Similar to #995 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants