Fixed: [website] Handling Events shows wrong 'current' highlight (#10998)
Nic Bonetto committed
Oct 2, 2017 at 08:56 UTC
61a1adbda1fc3ac11fe5054df997e6272d5c7557
2 files changed
+5
-5
www/src/utils/findSectionForPath.js
+3
-4
@@ -17,15 +17,14 @@ import slugify from './slugify';
17
*/
18
const findSectionForPath = (pathname, sections) => {
19
let activeSection;
20
+ const slugId = pathname.split('/').slice(-1)[0];
21
22
sections.forEach(section => {
23
const match = section.items.some(
24
item =>
24
- pathname.includes(slugify(item.id)) ||
25
+ slugId === slugify(item.id) ||
26
(item.subitems &&
26
- item.subitems.some(subitem =>
27
- pathname.includes(slugify(subitem.id)),
28
- )),
27
+ item.subitems.some(subitem => slugId === slugify(subitem.id))),
28
);
29
if (match) {
30
activeSection = section;
www/src/utils/isItemActive.js
+2
-1
@@ -27,7 +27,8 @@ const isItemActive = (location, item) => {
27
} else if (item.id.includes('html')) {
28
return location.pathname.includes(item.id);
29
} else {
30
- return location.pathname.includes(slugify(item.id));
30
+ const slugId = location.pathname.split('/').slice(-1)[0];
31
+ return slugId === slugify(item.id);
32
}
33
};
34