diff --git a/web/e2e/libraryVeil.e2e.ts b/web/e2e/libraryVeil.e2e.ts new file mode 100644 index 0000000..0aa7380 --- /dev/null +++ b/web/e2e/libraryVeil.e2e.ts @@ -0,0 +1,42 @@ +import { expect, fixtures, landed, test } from './fixture'; + +/** + * The band over the Library's list, from the window's top to the columns' line, is one veil edge to + * edge: a cover or an artist's name scrolled under it is hidden across the whole width, never only + * over the songs, where a cover's shadow drew a pale box round the narrower one. + */ +test('the veil over the list spans the page, and the rail and filters stay over it', async ({ + page +}) => { + await page.setViewportSize({ width: 1800, height: 900 }); + await page.goto(fixtures('/library')); + await landed(page); + await page.mouse.move(1200, 500); + await page.mouse.wheel(0, 1500); + await expect + .poll(() => page.evaluate(() => document.scrollingElement?.scrollTop ?? 0)) + .toBeGreaterThan(1000); + + const hits = await page.evaluate(() => { + const head = document.querySelector('.columns-head'); + const line = head === null ? 0 : head.getBoundingClientRect().bottom; + const covers = document.querySelector('.albums')?.getBoundingClientRect().left ?? 0; + // Below the nav, above the line: left of the covers, over a cover, and the window's edge. + const y = line - 12; + const at = (x: number): string => { + const top = document.elementFromPoint(x, y); + return top?.closest('.columns-head, .top, .rail') === null ? 'through' : 'veiled'; + }; + return [at(covers - 20), at(covers + 40), at(4)]; + }); + expect(hits).toEqual(['veiled', 'veiled', 'veiled']); + + await expect(page.locator('.top').getByRole('button', { name: 'Everything' })).toBeVisible(); + const rail = page.locator('.rail'); + const railTop = await rail.evaluate((el) => { + const r = el.getBoundingClientRect(); + const top = document.elementFromPoint(r.left + r.width / 2, r.top + 6); + return el.contains(top); + }); + expect(railTop).toBe(true); +}); diff --git a/web/src/lib/pages/LibraryRail.svelte b/web/src/lib/pages/LibraryRail.svelte index ccc3298..130a900 100644 --- a/web/src/lib/pages/LibraryRail.svelte +++ b/web/src/lib/pages/LibraryRail.svelte @@ -368,7 +368,7 @@ --pill-inset: 1.5px; position: fixed; - z-index: 1; + z-index: 3; top: 104px; right: 24px; width: 32px; diff --git a/web/src/routes/library/+page.svelte b/web/src/routes/library/+page.svelte index 9de0104..5938c92 100644 --- a/web/src/routes/library/+page.svelte +++ b/web/src/routes/library/+page.svelte @@ -771,7 +771,7 @@ /* Solid, because the name it stands under leaves upward, past it. */ .top { position: fixed; - z-index: 2; + z-index: 3; top: var(--head-top); left: var(--page-edge); width: var(--name-column); @@ -908,13 +908,16 @@ background: var(--ground); } + /* The veil: the whole band above the list line, edge to edge, so a cover's shadow or an artist's + name passing under it is cut by one straight line and never shows round a narrower box. */ .columns-head::before { content: ''; position: absolute; - left: 0; - right: 0; - bottom: 100%; - height: var(--head-top); + z-index: -1; + top: calc(-1 * var(--head-top)); + bottom: 0; + left: calc(-1 * var(--songs-left)); + right: calc(-1 * var(--songs-right)); background: var(--ground); }