Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions client/src/components/BackToTop.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.back-to-top {
position: fixed;
right: max(0.75rem, env(safe-area-inset-right));
top: max(1rem, env(safe-area-inset-top));
right: max(1rem, env(safe-area-inset-right));
bottom: max(1.25rem, env(safe-area-inset-bottom));
z-index: 2;
display: flex;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.375rem;
width: fit-content;
max-width: calc(100% - 1.5rem);
min-height: 2.75rem;
padding: 0.5rem;
padding: 0.5rem 0.875rem;
border: 1px solid var(--accent);
border-radius: 100px;
background: var(--surface);
Expand All @@ -20,8 +20,9 @@
font-weight: 700;
}

.back-to-top span {
.back-to-top__icon {
font-size: 1.25rem;
line-height: 1;
}

.back-to-top:hover {
Expand All @@ -31,8 +32,15 @@

@media (max-width: 700px) {
.back-to-top {
/* Keep narrow-screen controls clear, including with enlarged text. */
position: static;
margin: 1.5rem 0 0 auto;
right: max(0.75rem, env(safe-area-inset-right));
bottom: max(1rem, env(safe-area-inset-bottom));
width: 2.75rem;
height: 2.75rem;
padding: 0;
border-radius: 50%;
}

.back-to-top__label {
display: none;
}
}
20 changes: 19 additions & 1 deletion client/src/components/BackToTop.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { afterEach, expect, it, vi } from 'vitest';
import { fireEvent, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import axe from 'axe-core';

import BackToTop from './BackToTop.js';

Expand All @@ -16,14 +17,31 @@ it('appears after 600px, hides near the top and removes its listener on unmount'
expect(screen.queryByRole('button', { name: 'Back to top' })).not.toBeInTheDocument();
vi.stubGlobal('scrollY', 601);
fireEvent.scroll(window);
expect(screen.getByRole('button', { name: 'Back to top' })).toHaveTextContent('Top');
const button = screen.getByRole('button', { name: 'Back to top' });
expect(button).toHaveTextContent('Top');
expect(button.querySelector('.back-to-top__icon')).toHaveAttribute(
'aria-hidden',
'true',
);
expect(button.querySelector('.back-to-top__label')).toHaveTextContent('Top');
vi.stubGlobal('scrollY', 600);
fireEvent.scroll(window);
expect(screen.queryByRole('button', { name: 'Back to top' })).not.toBeInTheDocument();
unmount();
expect(removeListener).toHaveBeenCalledWith('scroll', expect.any(Function));
});

it('keeps an accessible label and passes axe when visible', async () => {
vi.stubGlobal('scrollY', 650);
const { container } = render(<BackToTop />);
const button = screen.getByRole('button', { name: 'Back to top' });
expect(button).toHaveAttribute('aria-label', 'Back to top');
const results = await axe.run(container, {
rules: { 'color-contrast': { enabled: false } },
});
expect(results.violations).toEqual([]);
});

it.each([
['click', false, 'smooth'],
['{Enter}', false, 'smooth'],
Expand Down
6 changes: 4 additions & 2 deletions client/src/components/BackToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export default function BackToTop() {
});
}}
>
<span aria-hidden="true">↑</span>
Top
<span className="back-to-top__icon" aria-hidden="true">
↑
</span>
<span className="back-to-top__label">Top</span>
</button>
);
}
6 changes: 6 additions & 0 deletions client/src/components/ResultsLayout.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
.results {
padding-bottom: 2.5rem;
}
@media (max-width: 700px) {
/* Leave clearance above the floating bottom-right Back to top button. */
.results {
padding-bottom: 4.5rem;
}
}
.results-header {
margin-bottom: 1rem;
}
Expand Down
1 change: 1 addition & 0 deletions docs/AI-USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ the part that matters most.
| 2026-11-13 | robertky | Codex (ChatGPT) | Assisted me with #26: polished the README, added screenshots and project-document links, and verified the local setup from a clean clone. I reviewed the changes and updated the implementation notes to reflect merged browsing and country-filter features. |
| 2026-11-17 | erikhfj | Antigravity | #91, E2E search helper fix: updated `e2e/tests/search.spec.ts` to match the `Search` and `Filters` buttons with `exact: true` so `Clear recent searches` does not trigger a strict-mode violation, and cleared `E2E_USER_ID`'s recorded search history during cleanup. Verified locally with two consecutive full `pnpm test:e2e` runs against a throwaway seeded PostgreSQL stack. |
| 2026-11-20 | erikhfj | Antigravity | #100, review author privacy: removed `User.id` from `schema.graphql` and the `AlbumDetail` query, replaced `Listener <uuid-prefix>` with deterministic SHA-256 music pseudonyms in `server/src/userIdentity.ts` (including read-time sanitization of legacy labels in `Review.user`), added `User` cache merge policy, and updated schema/unit/client tests and `docs/architecture.md`. Verified with `pnpm codegen`, `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build`. |
| 2026-11-20 | erikhfj | Antigravity | #102, floating mobile Back to Top button: positioned `BackToTop` fixed at bottom-right across viewports with a compact 44px circular icon-only layout on mobile (`<= 700px`), preserved the `Back to top` accessible name, added bottom clearance on `.results` so controls such as `Load more` stay unobstructed, and expanded `BackToTop.test.tsx`. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build`. |

## Notes

Expand Down