fix(lyrics): resolve scrolling in ExpandedPlayer full screen view

- Add min-height: 0 and height: 100% to .right-section for proper
  flex constraint cascade
- Add overflow: hidden to .lyrics-container for mask effect
- Add max-height: 100% and overflow-y: auto to .lyrics-lines
- Fix reset effect to track content changes vs array reference
- Remove debug console.logs
This commit is contained in:
vicrodh committed 2026-01-11 01:50:08 -06:00
1 parent fd178b8643
commit 0ca7d50615
2 files changed
+8 -27

No files matched your search

+5 -2
View File
@@ -93,9 +93,7 @@
// Ensure lyrics updates run when ExpandedPlayer is open with synced lyrics
$effect(() => {
console.log('[ExpandedPlayer] Effect check:', { isOpen, isPlaying, lyricsSynced, lyricsActiveIndex, hasLyrics: lyricsLines.length > 0 });
if (isOpen && isPlaying && lyricsSynced) {
console.log('[ExpandedPlayer] Starting lyrics updates');
startActiveLineUpdates();
}
});
@@ -665,17 +663,20 @@
.right-section {
flex: 1;
min-width: 0;
min-height: 0; /* Critical for nested flex to respect max-height */
display: flex;
flex-direction: column;
justify-content: center;
overflow: hidden;
padding-right: 40px;
height: 100%; /* Explicit height for proper constraint cascade */
}
.lyrics-container {
flex: 1;
min-height: 0; /* Critical for flex child to allow shrinking */
max-height: calc(100vh - 160px);
overflow: hidden; /* Clip content for mask effect */
mask-image: linear-gradient(
to bottom,
transparent 0%,
@@ -699,6 +700,8 @@
--bg-tertiary: rgba(255, 255, 255, 0.08);
padding: 0;
height: 100%;
max-height: 100%; /* Constrain to parent height */
overflow-y: auto; /* Ensure scrolling works */
}
.lyrics-state {
+3 -25
View File
@@ -48,18 +48,11 @@
// Scroll active line into view (centered)
// instant: true for catch-up sync, false for normal progression
async function scrollActiveIntoView(index: number, instant: boolean = false) {
console.log('[LyricsLines] scrollActiveIntoView called', { index, instant, hasContainer: !!container });
if (!container || index < 0) {
console.log('[LyricsLines] Early return - no container or invalid index');
return;
}
if (!container || index < 0) return;
await tick();
const target = container.querySelector<HTMLElement>(`[data-line-index="${index}"]`);
console.log('[LyricsLines] Found target element:', !!target);
if (!target) return;
const containerRect = container.getBoundingClientRect();
@@ -68,8 +61,6 @@
const containerCenter = containerRect.top + containerRect.height / 2;
const scrollOffset = targetCenter - containerCenter;
console.log('[LyricsLines] Scrolling by', scrollOffset, { targetCenter, containerCenter });
container.scrollBy({
top: scrollOffset,
behavior: instant ? 'instant' : 'smooth'
@@ -78,26 +69,14 @@
// React to activeIndex changes - scroll to keep active line visible
$effect(() => {
console.log('[LyricsLines] Effect running', { scrollToActive, activeIndex, isSynced, lastScrolledIndex });
// Only scroll if we should and have a valid index
if (!scrollToActive || activeIndex < 0 || !isSynced) {
console.log('[LyricsLines] Skipping scroll - conditions not met');
return;
}
// Skip if we already scrolled to this index
if (activeIndex === lastScrolledIndex) {
console.log('[LyricsLines] Skipping scroll - same index');
return;
}
if (!scrollToActive || activeIndex < 0 || !isSynced) return;
if (activeIndex === lastScrolledIndex) return;
// Determine scroll behavior
const isLargeJump = lastScrolledIndex >= 0 && Math.abs(activeIndex - lastScrolledIndex) > 2;
const isInitialSync = lastScrolledIndex === -1 && activeIndex > 0;
const useInstant = isLargeJump || isInitialSync;
console.log('[LyricsLines] Will scroll to', activeIndex, { isLargeJump, isInitialSync, useInstant });
lastScrolledIndex = activeIndex;
scrollActiveIntoView(activeIndex, useInstant);
});
@@ -107,7 +86,6 @@
$effect(() => {
const newKey = lines.length > 0 ? `${lines.length}-${lines[0].text}` : '';
if (newKey !== lastLyricsKey) {
console.log('[LyricsLines] Lyrics content changed, resetting scroll tracking');
lastLyricsKey = newKey;
lastScrolledIndex = -1;
}