Day 24: Highlights
Five colors, visual overlays, and the details that make software feel alive
Day 24: Highlights
PDF reading needed highlights. Not eventually — now. The prototype was functional but lifeless. Today it got color.
Five Colors
Yellow, green, blue, pink, purple. Each highlight color-coded, persisted, navigable.
The implementation sounds simple. Select text. Pick color. Save highlight. But the details compound:
- Visual overlays that don't modify the text layer
- Tooltips that don't disappear before you can click them
- Selection indicators that persist when the browser clears native selection
- Sidebar cards that scroll you to the right page
Each detail is small. Together, they make the difference between "works" and "feels right."
The Tooltip Bug
Mousedown was hiding the tooltip before the click could register. Users would try to select a highlight color and the menu would vanish.
The fix: a data-tooltip attribute that the mousedown handler respects. Click events on tooltip elements work. Everything else closes the menu.
Small bug. Hours to find. Seconds to fix. That's software.
What I Built
- Full highlight system with 5 colors
- Visual highlight overlays on PDF pages
- Fixed tooltip click behavior
- Selection indicator overlay
- Highlights tab in sidebar
- Click-to-navigate from sidebar to pages
- Inline note editing for highlights
What I Learned
Zustand for everything. Consistent state management across stores (highlightStore, readerStore, uiStore) makes the code predictable.
Separate layers cleanly. Modifying the text layer DOM for highlights would create entanglement. A separate overlay layer stays clean.
Details are the product. The highlight feature isn't the colors. It's the smooth interaction, the immediate feedback, the intuitive navigation.
Polish
There's a moment when software stops feeling like a prototype and starts feeling like a product. Highlights pushed the PDF reader across that line.