Commit e3f01b7
committed
Fix: Correctly highlight active navigation link on scroll
The previous implementation had a logic flaw where the active navigation link would not be cleared correctly when scrolling between sections. This was because the `setActive` function was only called when a section was in view, but it was not cleared when no section was active.
This commit refactors the scroll event handler in `Navbar.tsx` to correctly identify the active section and clear the highlighting if no section is active, regardless of the scroll position. This ensures that the active link is always correctly highlighted.1 parent c62cc24 commit e3f01b7
File tree
6 files changed
+57
-13
lines changed- jules-scratch/verification
- src/components/layout
6 files changed
+57
-13
lines changedLoading
Loading
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 17 | + | |
26 | 18 | | |
27 | | - | |
28 | 19 | | |
| 20 | + | |
29 | 21 | | |
30 | 22 | | |
31 | 23 | | |
| |||
35 | 27 | | |
36 | 28 | | |
37 | 29 | | |
38 | | - | |
| 30 | + | |
39 | 31 | | |
40 | 32 | | |
| 33 | + | |
| 34 | + | |
41 | 35 | | |
42 | 36 | | |
43 | | - | |
| 37 | + | |
44 | 38 | | |
45 | 39 | | |
46 | 40 | | |
47 | | - | |
48 | 41 | | |
49 | 42 | | |
50 | 43 | | |
| |||
0 commit comments