This commit is contained in:
Andrey Kondratev
2025-08-29 16:00:05 +05:00
parent 096916eced
commit 9e18de85eb
3 changed files with 69 additions and 28 deletions

View File

@@ -0,0 +1,22 @@
# Song Tile State Fix
## Problem Identified
Song tiles were not returning to normal state after download completion because the code was using `document.activeElement` instead of the actual clicked element.
## Root Cause
- `convertVideo()` method used `document.activeElement` to get the element to style
- `document.activeElement` might not be the correct song tile, especially during async operations
- The `finally` block tried to remove `tg-list-item--converting` class from wrong element
## Solution Implemented
- Replaced `document.activeElement` with `document.querySelector(\`[onclick*="${videoId}"]\`)`
- This finds the specific song tile that contains the videoId in its onclick attribute
- Ensures the correct element gets the converting state and has it properly removed
## Code Location
- File: `public/script.ts`
- Method: `convertVideo()` around line 212-218
- Changed element selection logic to target the correct clicked song tile
## Result
Song tiles now properly return to normal state after download/conversion completes (both success and error cases).