Files
quixotic/.serena/memories/song_tile_state_fix.md
Andrey Kondratev 9e18de85eb fixes?
2025-08-29 16:00:05 +05:00

1.1 KiB

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).