Animate the account menu and document player motion conventions

This commit is contained in:
ab committed 2026-11-24 04:35:31 +02:00
1 parent 88fb82b081
commit 388dc9b745
4 files changed
+36 -3

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# Web player interactions
Give player controls immediate visual feedback. Use short transitions in both directions when menus and dialogs open or close, sections expand or collapse, and items appear or disappear. Match the pace of nearby controls, typically 120–160 ms, and keep the surrounding layout steady.
Honor `prefers-reduced-motion` and keep controls responsive to repeated clicks and keyboard input during transitions.
+2 -2
View File
@@ -24,7 +24,7 @@
<span class="user-name" x-text="$store.user.profile?.name"></span>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 14 6-6 6 6"/></svg>
</button>
<div class="sidebar-account-popover" id="sidebar-account-actions" x-show="$store.user.menuOpen" x-cloak>
<div class="sidebar-account-popover account-popover" id="sidebar-account-actions" inert :inert="$store.user.menuOpen ? null : true" x-cloak>
{% include "player/account_actions.html" %}
</div>
</div>
@@ -143,7 +143,7 @@
@click="$store.mobile.closeLibrary(); $store.user.menuOpen = !$store.user.menuOpen">
<span class="user-avatar" x-text="$store.user.initials()"></span>
</button>
<div class="mobile-account-popover" id="mobile-account-actions" x-show="$store.user.menuOpen" x-cloak>
<div class="mobile-account-popover account-popover" id="mobile-account-actions" inert :inert="$store.user.menuOpen ? null : true" x-cloak>
<div class="account-menu-name" x-text="$store.user.profile?.name"></div>
{% include "player/account_actions.html" %}
</div>
+15
View File
@@ -133,6 +133,21 @@
.mobile-account-control .mobile-account-chip { width: 42px; padding: 0; justify-content: center; }
.mobile-account-control .mobile-account-popover { top: calc(100% + 6px); right: 0; width: min(240px, calc(100vw - 24px)); }
.sidebar-account-popover, .mobile-account-control .mobile-account-popover {max-height:calc(100dvh - var(--player-bar-space) - 72px);overflow-y:auto;overscroll-behavior:contain}
.account-popover[inert] { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
.account-popover {
/* Leave room for the shadow when the panel is fully open. */
clip-path: inset(-32px);
opacity: 1;
transition: clip-path 150ms ease-out, opacity 120ms ease-out;
}
.account-popover[inert] {
clip-path: inset(100% -32px 0);
opacity: 0;
transition: clip-path 110ms ease-in, opacity 110ms ease-in, visibility 0s 110ms;
}
.mobile-account-popover[inert] { clip-path: inset(0 -32px 100%); }
}
.mobile-library-backdrop { color: var(--text-primary); padding: 0; border: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; }
.mobile-library-backdrop::backdrop { background: transparent; }
.mobile-library-drawer .music-nav { padding: 4px 2px; overflow: visible; }
+14 -1
View File
@@ -136,6 +136,19 @@ async function checkSidebar(browser, mobile) {
}
const trigger = page.locator(mobile ? '.mobile-account-chip' : '.sidebar-account-trigger');
const panel = page.locator(mobile ? '#mobile-account-actions' : '#sidebar-account-actions');
await panel.evaluate(el => {
window.accountTransitions = [];
el.addEventListener('transitionend', event => {
if (event.target === el && event.propertyName === 'clip-path') window.accountTransitions.push(el.inert);
});
});
await trigger.click();
await page.waitForFunction(() => window.accountTransitions.includes(false));
await trigger.click();
await panel.waitFor({state:'hidden'});
await page.waitForFunction(() => window.accountTransitions.includes(true));
await page.emulateMedia({reducedMotion:'reduce'});
assert.equal(await panel.evaluate(el => getComputedStyle(el).transitionDuration), '0s');
await trigger.click();
await panel.getByRole('link', {name:'Followed'}).click();
await page.getByRole('heading', {name:'Followed', exact:true}).waitFor();
@@ -154,7 +167,7 @@ async function checkSidebar(browser, mobile) {
await trigger.click();
await panel.getByRole('button', { name: 'Settings' }).click();
await page.locator('.user-settings-modal').waitFor();
assert.equal(await panel.isVisible(), false);
await panel.waitFor({state:'hidden'});
await checkOfflineControls(page, trigger, panel);
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false);
assert.deepEqual(errors, []);