Repository navigation
v1.6.2 - Up Arrow Navigation Completely Fixed!
🎯 Complete Fix for Up Arrow Navigation
This release completely rewrites the up arrow navigation system to be 100% reliable!
What Was Wrong (Technical Deep Dive)
The previous implementation had a fundamental flaw:
// OLD APPROACH ❌
referenceLinkLocations.set(num, domElement);
// Later...
domElement.scrollIntoView(); // Element might be invalid!Problems:
- Stored DOM element references in a Map
- These became stale when MutationObserver re-ran
- Elements could be detached or replaced
- Map could be cleared, losing all references
The New Architecture ✅
// NEW APPROACH ✅
wrapper.setAttribute('data-ref-link', num);
// Later...
const element = document.querySelector(`[data-ref-link="${num}"]`);
element.scrollIntoView(); // Always finds the current element!Benefits:
- Uses
data-ref-linkattribute on each reference wrapper - Dynamically queries for elements when needed
- No stale references - always finds current DOM element
- Survives all page mutations and changes
- Added console warnings for debugging
🔧 What's Fixed
✅ Up arrows (↑) now work 100% of the time
✅ No more "sometimes works, sometimes doesn't"
✅ Survives dynamic page content changes
✅ Works after MutationObserver runs
✅ Console warnings if reference not found
📦 Update Now!
Tampermonkey will detect this is v1.6.2 and prompt you to reinstall.
🧪 How to Test
- Go to any ByteByteGo article with references
- Scroll down to the References/Resources section
- Click any up arrow (↑)
- It should scroll to the reference in the article and highlight it
- Works every single time! 🎉
🐛 Still Having Issues?
If up arrows still don't work:
- Open browser console (F12)
- Look for warnings like:
[ByteByteGo Refs] Could not find reference [X] in article - This means the reference
[X]doesn't exist in the article text - Report the issue with the article URL
📊 Technical Changes
- Added
data-ref-linkattribute to reference wrappers - Both
.ref-lineand<ol>implementations updated - Dynamic element lookup on every click
- Removed dependency on DOM element storage
- Better error handling with console warnings
This is the definitive fix for up arrow navigation! 🚀