Skip to content

Replace native select with custom sort menu component - #10

Merged
renderghost merged 1 commit into
mainfrom
claude/adoring-cannon-4urwk0
Oct 26, 2026
Merged

renderghost merged 1 commit into
mainfrom
claude/adoring-cannon-4urwk0

Conversation

@renderghost

Copy link
Copy Markdown
Owner

Summary

Replaces the native HTML <select> element for sorting with a custom, accessible dropdown menu built from radio buttons. This enables more sophisticated sorting options and improved UX while maintaining full keyboard and screen reader support.

Key Changes

Sorting Logic

  • Restructured sort definitions in filter.js: Each sort now specifies its natural direction (asc/desc), value extractor, and comparison function, replacing simple comparator functions
  • Added bidirectional sorting: Introduced order parameter (asc/desc) to applyView(), allowing users to reverse any sort direction
  • Expanded sort options: Changed from 3 sorts (newest, updated, az) to 3 with explicit directions (created, updated, title)
  • Added sort parsing: New parseSort() and parseOrder() functions handle legacy URL parameters and validation
  • Improved tie-breaking: All sorts now break ties by title, then by tags, ensuring consistent ordering

UI Components

  • New sort menu component (sort-menu.js): Custom dropdown built from fieldsets of radio buttons with:

    • Two groups: "Sort by" (created/updated/title) and "Order" (asc/desc)
    • Dynamic direction labels that change based on sort type (e.g., "Newest first" vs "A–Z")
    • Full keyboard navigation (arrow keys, Tab, Escape)
    • Pointer/click handling with smooth close animation
    • Proper ARIA attributes for accessibility
  • Updated HTML structure (views/index.ejs): Replaced <select> with button + hidden menu containing radio button groups

  • Comprehensive styling (app.css):

    • .sort-button: Toggle button with sort glyph and chevron
    • .sort-menu: Positioned dropdown with frosted glass effect
    • .sort-option: Radio button styled as clickable rows with checkmark indicators
    • Responsive adjustments for mobile (hides chevron, reduces padding)

Data Model Changes

  • Tags restructured: Changed from single tag field to tags array throughout:

    • parseTitle() now extracts multiple trailing parenthetical tags
    • searchText() includes all tags
    • popularTags() counts each playlist once per tag (case-insensitive)
    • Filter logic checks if any tag matches
  • Cache versioning: Bumped from v1 to v2 due to data structure changes

Grid & Dialog Updates

  • Card layout: Replaced single tag chip with flexible tag container; improved spacing and alignment
  • Card title: Changed from 2-line clamp to single-line ellipsis with full title in tooltip
  • Card stats: Now pinned to bottom with margin-top: auto for consistent alignment
  • Dialog layout: Refactored sheet to use flexbox for info column (artwork + details) beside player, enabling proper scrolling when content exceeds viewport

Testing

  • Updated test fixtures to use tags: [] array format
  • Added comprehensive sort direction tests
  • Verified tag filtering works with multiple tags per playlist
  • Confirmed legacy sort parameter names still work

Implementation Details

  • Sort menu uses hidden attribute with CSS transitions for smooth open/close
  • Radio buttons positioned absolutely with full opacity 0 to maintain native form behavior while allowing custom styling
  • Direction labels dynamically update based on selected sort (dates show "Newest/Oldest first", titles show "A–Z/Z–A")
  • Responsive design hides chevron icon on mobile while keeping sort glyph visible
  • All changes maintain backward compatibility with existing URLs through parseSort() translation

https://claude.ai/code/session_01Q1hM7kWipKSvW8y4JtxKbH

Cards: every card now has the same four rows (artwork, one-line title,
tags, track count and duration). The description is gone from the card;
it is still in the dialog and still searchable. A title can carry
several trailing "(…)" brackets, each its own tag, so records now have
`tags` instead of `tag`; filtering, search and the tag chips follow, and
the browser cache key moves to v2 (v1 entries are removed).

Dialog: it has a set height and the layout fills it, so TIDAL's player
always ends inside the padding. The artwork, details and actions scroll
in their own column beside it, with the actions above the description.

Sorting: Created, Updated or Title, each reversible. A menu lists the
sort fields, a line, then the direction, worded to suit the field
(Newest first / Oldest first, A–Z / Z–A). The button shows the current
direction. The URL gains ?order=; old ?sort=newest and ?sort=az links
still work.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q1hM7kWipKSvW8y4JtxKbH
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
selections Ready Ready Preview Oct 26, 2026 7:45am UTC

@renderghost
renderghost merged commit 19f8897 into main Oct 26, 2026
4 checks passed
@renderghost
renderghost deleted the claude/adoring-cannon-4urwk0 branch October 26, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants