fixes?
This commit is contained in:
22
.serena/memories/song_tile_state_fix.md
Normal file
22
.serena/memories/song_tile_state_fix.md
Normal 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).
|
||||
Reference in New Issue
Block a user