Skip to content

Commit b991929

Browse files
authored
Merge pull request #87 from studioespresso/86-nodeactive-incorrectly-returns-true-for-headings
86 nodeactive incorrectly returns true for headings
2 parents cdd2592 + 078635e commit b991929

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 5.1.5 - Unreleased
8+
### Fixed
9+
- Headings should never be marked as active ([#86](https://github.com/studioespresso/craft-navigate/issues/86)
10+
711
## 5.1.4 - 2025-05-29
812
### Fixed
913
- Fix for updating url node values ([#82](https://github.com/studioespresso/craft-navigate/issues/82))

src/models/NodeModel.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public function rules(): array
9292

9393
/**
9494
* Added to make migrating from amNav easier
95-
* @since 2.6.0
9695
* @return mixed
9796
* @throws \craft\errors\DeprecationException
97+
* @since 2.6.0
9898
*/
9999
public function listClass()
100100
{
@@ -105,9 +105,9 @@ public function listClass()
105105

106106
/**
107107
* Added to make migrating from amNav easier
108-
* @since 2.6.0
109108
* @return mixed
110109
* @throws \craft\errors\DeprecationException
110+
* @since 2.6.0
111111
*/
112112
public function hasChildren()
113113
{
@@ -130,13 +130,14 @@ public function active()
130130
if (substr("/" . Craft::$app->request->getPathInfo(), 0, strlen($this->url)) === $this->url) {
131131
return true;
132132
}
133-
134133
break;
134+
case 'heading':
135+
return false;
135136
default:
136137
if ($this->url === Craft::$app->request->getAbsoluteUrl()) {
137138
return true;
138139
}
139-
140+
140141
if (strpos(Craft::$app->request->getAbsoluteUrl(), '?')) {
141142
if (explode('?', Craft::$app->request->getAbsoluteUrl())[0] === $this->url) {
142143
return true;
@@ -163,13 +164,14 @@ public function current()
163164
if (substr("/" . Craft::$app->request->getPathInfo(), 0, strlen($this->url)) === $this->url) {
164165
return true;
165166
}
166-
167167
break;
168+
case 'heading':
169+
return false;
168170
default:
169171
if ($this->url === Craft::$app->request->getAbsoluteUrl()) {
170172
return true;
171173
}
172-
174+
173175
if (strpos(Craft::$app->request->getAbsoluteUrl(), '?')) {
174176
if (explode('?', Craft::$app->request->getAbsoluteUrl())[0] === $this->url) {
175177
return true;

0 commit comments

Comments
 (0)