()
| 727 | |
| 728 | // Cleanup on page unload |
| 729 | const cleanup = () => { |
| 730 | clearInterval(cleanupInterval); |
| 731 | detector.clear(); |
| 732 | console.log('🧹 Dropdown detection cleaned up'); |
| 733 | }; |
| 734 | |
| 735 | // beforeunload doesn't always fire (bfcache, mobile browsers) |
| 736 | window.addEventListener('beforeunload', cleanup); |