Skip to content

v1.6.2 - Up Arrow Navigation Completely Fixed!

Choose a tag to compare

@abd3lraouf abd3lraouf released this 06 Dec 15:03
· 18 commits to main since this release

🎯 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-link attribute 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!

Click to Update

Tampermonkey will detect this is v1.6.2 and prompt you to reinstall.

🧪 How to Test

  1. Go to any ByteByteGo article with references
  2. Scroll down to the References/Resources section
  3. Click any up arrow (↑)
  4. It should scroll to the reference in the article and highlight it
  5. Works every single time! 🎉

🐛 Still Having Issues?

If up arrows still don't work:

  1. Open browser console (F12)
  2. Look for warnings like: [ByteByteGo Refs] Could not find reference [X] in article
  3. This means the reference [X] doesn't exist in the article text
  4. Report the issue with the article URL

📊 Technical Changes

  • Added data-ref-link attribute to reference wrappers
  • Both .ref-line and <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! 🚀