fix: delay pulse animation to let scroll complete first

- Add 500ms delay before starting pulse animation
- Prevents pulse from starting while element is still scrolling
- Creates better visual flow: scroll → pause → pulse
- Makes the highlight easier to track with your eyes

The pulse now starts after the smooth scroll completes,
making it much clearer which highlight you jumped to.
This commit is contained in:
Gigi
2025-10-05 02:10:17 +01:00
parent a4c15ecc0e
commit 5f8d4b2c47

View File

@@ -44,13 +44,15 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
console.log('📍 Scrolling to highlight in article:', selectedHighlightId.slice(0, 8))
markElement.scrollIntoView({ behavior: 'smooth', block: 'center' })
// Add pulsing animation to show it's selected
// Add pulsing animation after scroll completes
const htmlElement = markElement as HTMLElement
htmlElement.classList.add('highlight-pulse')
setTimeout(() => {
htmlElement.classList.remove('highlight-pulse')
}, 1500)
htmlElement.classList.add('highlight-pulse')
setTimeout(() => {
htmlElement.classList.remove('highlight-pulse')
}, 1500)
}, 500) // Delay to let scroll animation complete
} else {
console.log('⚠️ Could not find mark element for highlight:', selectedHighlightId.slice(0, 8))
}