Ahoy! Never lose the thread.
A Chrome extension that enhances the Reddit comment reading experience:
Sticky ancestor header — Pins ancestor comments at the top so you never lose context in deeply nested threads
- Shows the ancestor chain for the comment you're currently reading
- Configurable number of pinned rows (1-10)
- Compact mode for minimal UI footprint
- Click any row to jump to that comment
- Automatically positions below Reddit's header
- Smooth updates as you scroll
thread-anchor/
├── extension/
│ ├── manifest.json # Chrome extension manifest (MV3)
│ ├── assets/
│ │ ├── icon16.png
│ │ ├── icon48.png
│ │ └── icon128.png
│ └── src/
│ ├── content/ # Content scripts (injected into Reddit)
│ │ ├── selectors.js # DOM selectors & helpers for Reddit
│ │ ├── util.js # Utilities (debounce, throttle, perf tools)
│ │ ├── ancestors.js # Ancestor chain computation
│ │ ├── activeComment.js # Active comment tracking
│ │ ├── stickyUI.js # Sticky header UI
│ │ └── main.js # Entry point & settings management
│ └── popup/ # Extension popup UI
│ ├── popup.html
│ ├── popup.css
│ └── popup.js
├── plan.md # Original design document
├── task.md # Implementation task checklist
└── README.md
- Google Chrome or any Chromium-based browser (Edge, Brave, etc.)
- No build tools required — vanilla JavaScript
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in top right)
- Click Load unpacked
- Select the
extension/directory from this project - The extension icon should appear in your toolbar
- Navigate to any Reddit comment thread (e.g.,
https://old.reddit.com/r/*/comments/*orhttps://www.reddit.com/r/*/comments/*) - Click the extension icon to open the settings popup
- Toggle features on/off and adjust settings
- Scroll through comments to see the features in action
Open the browser console (F12 → Console) on a Reddit page to see debug logs:
[ThreadAnchor] Initializing...
[ThreadAnchor] Initialized with settings: {...}
[ActiveComment] Initialized
[StickyUI] Initialized with config: {...}
The extension includes built-in performance utilities. In the console:
// Enable performance tracking
Util.setPerfEnabled(true);
// Scroll around to collect metrics...
// View performance stats
Util.perfLog();
// Clear metrics
Util.perfClear();Settings are stored in chrome.storage.sync and persist across sessions.
| Setting | Default | Description |
|---|---|---|
stickyAncestorsEnabled |
true |
Enable sticky header feature |
stickyDepth |
3 |
Number of ancestor rows to show |
stickyCompact |
true |
Use compact single-line rows |
Scripts are loaded in dependency order (defined in manifest.json):
selectors.js— No dependenciesutil.js— No dependenciesancestors.js— Depends on SelectorsactiveComment.js— Depends on Selectors, UtilstickyUI.js— Depends on Selectors, Util, ActiveCommentmain.js— Orchestrates all modules
Each module uses the revealing module pattern:
const ModuleName = (() => {
// Private state and functions
function init(options) { /* ... */ }
function destroy() { /* ... */ }
// Public API
return { init, destroy };
})();- IntersectionObserver over scroll events — More performant for detecting visible elements
- WeakMap/WeakSet for caching — Automatic garbage collection when DOM elements are removed
- Click native controls — Expand comments by clicking Reddit's own buttons rather than mutating classes
- Debounced updates — Prevent excessive re-renders during fast scrolling
- Update version in
manifest.json - Create a ZIP of the
extension/directory:cd extension && zip -r ../thread-anchor.zip . && cd ..
- Go to Chrome Developer Dashboard
- Upload the ZIP file
- Fill in store listing details
- Submit for review
Share the extension/ folder directly. Users can load it as an unpacked extension following the development instructions above.
- Chrome 88+ (MV3 support)
- Edge 88+
- Brave (latest)
- Other Chromium browsers with MV3 support
MIT
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly on various Reddit threads
- Submit a pull request
- Check that the extension is enabled in
chrome://extensions/ - Try refreshing the Reddit page
- Check the console for error messages
The extension automatically adjusts body padding. If issues persist:
- Check if other extensions are conflicting
- Try disabling and re-enabling the sticky ancestors feature
- Try reducing the
stickyDepthsetting - Use
Util.perfLog()to identify bottlenecks