feedBack/tests
Matthew Harris Glover 23c509322b
Add gamepad/controller support (#1001)
* feat(input): add gamepad/controller support

Adds full gamepad/controller navigation and playback control, driven
by requests from players who use fee[dB]ack on a TV/console setup and
from wheelchair users for whom a controller is far more convenient
than a keyboard + mouse. Confirmed working end-to-end on a Steam Deck
across several rounds of on-device testing.

- static/v3/gamepad.js: polls navigator.getGamepads() and dispatches
  synthetic keydown events (Arrow/Enter/Space/Escape) on the focused
  element (falling back to document), reusing the app's existing
  keyboard pipeline (static/js/shortcuts.js's scope-aware dispatcher,
  player shortcuts, text-field/modal guards) instead of a parallel
  action-mapping table. Only acts on gamepads reporting the W3C
  "standard" mapping — which is what Steam Input presents for the
  Deck's built-in controls, both in Gaming Mode and in Desktop Mode
  via a non-Steam shortcut — so button order is guaranteed correct
  and a non-standard/raw device safely no-ops instead of misfiring.
  Handles Steam Input's virtual-pad duplicates (a real controller
  plus 1-2 mirrored XInput slots) without spamming connect toasts or
  losing input when the live pad isn't at index 0. Xbox-style face
  button mapping: bottom face = Space (play/pause, and activates the
  focused control), right face = Escape (back), top face reveals the
  player screen's tool rail (focuses it into visibility via the
  existing CSS :focus-within rule). D-pad/stick repeat while held,
  mirroring OS keyboard auto-repeat.

- static/v3/gamepad-nav.js: fills the one real gap in that reuse
  strategy — no screen but the song library grid had any arrow-key
  navigation, and Chromium doesn't run native Enter/Space button
  activation for untrusted synthetic events even when dispatched at
  the focused element. Gated entirely on `!e.isTrusted`, so it only
  ever reacts to gamepad-originated events and never touches real
  keyboard/mouse users: emulates Tab-order (the sidebar + active
  screen's real, already-focusable buttons/links) for Arrow keys,
  explicitly .click()s the focused element for Enter/Space, and gives
  Escape a consistent "go back" behavior — an existing in-screen back
  button if one's visible (reusing each screen's own drill-down logic
  for free), else the main menu. Every branch defers via
  `e.defaultPrevented` to any screen that already handles the key
  itself (the song grid, the player, settings), so nothing here
  overrides existing behavior.

- static/v3/songs.js: adds real 2D d-pad/arrow-key navigation to the
  song library's virtualized grid (only a slice of the library is
  ever in the DOM), including fetching/scrolling off-screen rows into
  view and correcting for the sticky filter toolbar's occlusion.

- static/v3/index.html: wires up the two new scripts.

* chore: regenerate stale tailwind.min.css

Rebuilt in a fresh clone (not the local working copy). Several plugin
directories (audio_engine, plugin_manager, community_charts, etc.) are
gitignored locally but present on disk from checking out plugin repos
for local dev/testing — Tailwind's content scan picks them up
regardless, so a rebuild against the contaminated local working copy
bakes in extra utility classes that don't belong in the real,
git-tracked build. A clean checkout reproduces CI's expected output
exactly.

* fix(gamepad): check all matching back buttons, not just the first

document.querySelector on the combined [data-ap-back], [data-albums-back],
#v3-pl-back selector only ever inspects the first match in DOM order —
since screens stay in the DOM (hidden, not removed) when you navigate
away, a hidden back button from an unrelated screen could sort before
the one that's actually visible, incorrectly falling through to
showScreen('v3-home') instead of clicking it. Uses querySelectorAll +
find(visible) instead.

* fix(gamepad): address CodeRabbit findings on connect/disconnect and grid nav

- gamepad.js: anyLiveConnectedPad -> anyLiveStandardPad, filtering by
  mapping === 'standard' like firstLiveStandardPad already does, and
  applied at the top of the gamepadconnected handler too. A still-
  connected non-standard raw mirror could otherwise mask the real
  pad's disconnect (toast never fires, polling never stops).

- songs.js _gpMove: an unset cursor now always seeds at index 0
  before the first press, instead of applying that press's delta
  immediately (ArrowDown/Right previously skipped straight past row
  0; Left/Up only looked right by accident of clamping). Matches the
  existing convention in shortcuts.js's legacy _handleLibArrowNav.

- songs.js _gpBlockedTarget: form-control/button blocking now
  requires the element to be visible (offsetParent !== null), not
  just present. Screens stay in the DOM hidden (not removed) when you
  navigate away, so a real button focused on some other now-hidden
  screen could leave document.activeElement pointing at it and block
  all grid navigation indefinitely. (An el.closest('#v3-songs') scope
  was tried first and reverted — it fixed that case but broke
  blocking for the topbar search input, which lives outside
  #v3-songs's DOM subtree even while v3-songs is active; visibility
  is the distinction that actually matters, not DOM nesting.)

Skipped two CodeRabbit suggestions, verified against current code:
gating songs.js's grid keydown listener to synthetic-only events
would regress the real keyboard accessibility this PR intentionally
added (v3-songs' grid had none before); renaming the _gp* helpers to
drop their underscore prefix would break from this codebase's own
established module-private naming convention.

Verified in-browser: first arrow press lands on index 0, stale hidden
focus no longer blocks grid nav, the topbar search input still
correctly blocks it, and normal nav resumes after blur.

* test(gamepad): unit-cover the controller + nav state machines

- gamepad.test.js (10): standard-mapping filter, Steam Input duplicate-slot
  dedup, disconnect masking, button edge-detection, d-pad/stick repeat timing,
  analog deadzone — driven via a fake navigator + manual rAF queue.
- gamepad_nav.test.js (10): !isTrusted/defaultPrevented gating, arrow focus
  traversal + clamping, hidden-element skipping, Enter/Space click activation
  (not into text fields/body), Escape visible-back-button vs home fallback.

songs.js grid nav is left to on-device coverage (async + windowed-DOM heavy).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Byron Gamatos <xasiklas@gmail.com>

---------

Signed-off-by: Byron Gamatos <xasiklas@gmail.com>
Co-authored-by: Byron Gamatos <xasiklas@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 11:52:51 +02:00
..
browser fix(plugins): restore window.esc for out-of-tree plugins (#986) 2026-07-16 12:06:52 +02:00
fixtures Remove unused binary test fixture; correct stale scan comments 2026-06-16 18:49:40 +01:00
js Add gamepad/controller support (#1001) 2026-07-19 11:52:51 +02:00
plugins fix(career): gig song selection — full-genre pool, working re-roll, and the venue pack loads (#976) 2026-07-15 10:50:55 +02:00
__init__.py Clean release snapshot 2026-06-16 18:47:13 +02:00
conftest.py refactor(server): carve the library scanner into lib/scan.py (R3b) (#901) 2026-07-12 01:26:02 +02:00
test_acoustid_match.py feat(enrichment): AcoustID audio-fingerprint identification (opt-in) (#759) 2026-07-05 00:17:43 +02:00
test_albums_view.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_appstate.py feat(server): add appstate.py, the router seam (R3) (#833) 2026-07-10 15:06:22 +02:00
test_art_candidates.py refactor(server): extract the album-art routes into routers/art.py (R3) (#862) 2026-07-11 11:56:53 +02:00
test_art_layer.py refactor(server): extract the album-art routes into routers/art.py (R3) (#862) 2026-07-11 11:56:53 +02:00
test_artist_alias.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_artist_page.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_artist_sort_title_order.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_audio_bundled.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_audio_effect_mappings.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_audio_local_path.py refactor(server): extract the media/file-serving routes into routers/media.py (R3) (#869) 2026-07-11 15:36:22 +02:00
test_audio.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_batch_user_meta.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_builtin_diagnostic_seed.py refactor(server): carve builtin-content seeding into lib/builtin_content.py (R3b) (#900) 2026-07-12 00:50:50 +02:00
test_builtin_starter_seed.py refactor(server): carve builtin-content seeding into lib/builtin_content.py (R3b) (#900) 2026-07-12 00:50:50 +02:00
test_collections_api.py refactor(server): extract library + collections routes + the provider registry (R3) (#866) 2026-07-11 14:56:12 +02:00
test_context_menu_api.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_correlation_id.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_curated_album.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_demo_mode.py fix(demo): the janitor re-entry guard actually works now (#902) (#909) 2026-07-12 11:30:53 +02:00
test_diagnostics_bundle.py fix(tests): isolate plugin routes modules + redact .feedpak filenames (#736) 2026-07-03 13:01:07 +02:00
test_diagnostics_hardware.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_diagnostics_redact.py fix(tests): isolate plugin routes modules + redact .feedpak filenames (#736) 2026-07-03 13:01:07 +02:00
test_dlc_junction.py fix(library): serve art/load for songs mounted through a library junction (#766) 2026-07-05 00:15:50 +02:00
test_drums_lib.py Purge external-format terminology from code, tests and docs 2026-06-16 19:36:53 +01:00
test_enrichment_plumbing.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_env_compat.py refactor(ui)!: remove the classic v2 shell — v3 is the only UI (R3a) (#871) 2026-07-11 16:33:03 +02:00
test_feedpak_extension.py perf(scan): skip full library re-stat when the tree is unchanged (#979) 2026-07-15 21:23:10 +02:00
test_field_overrides.py feat(library): effective genre falls back to MusicBrainz enrichment (#949) 2026-07-13 16:53:06 +02:00
test_gap_fill.py feat(v3 library): "Fix metadata" popup — per-song override + lock, cover picker, MusicBrainz + AcoustID (#777) 2026-07-05 21:09:38 +02:00
test_gp2midi.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_gp2notation.py fix: correctly import and notate multi-staff (piano/keys) tracks from GP8 (#692) 2026-07-02 08:40:20 +02:00
test_gp2rs_drums.py feat(drums): capture velocities alongside times in unmapped-percussion reporting (#808) 2026-07-07 23:58:49 +02:00
test_gp2rs_gpx.py fix(gpx): clamp partial final BCFS sector so GP6 .gpx import works (#749) 2026-07-05 00:20:31 +02:00
test_gp2rs_xml_encoding.py fix(gp2rs): write arrangement XML as UTF-8 so GP import survives non-ASCII metadata (#984) 2026-07-19 00:56:32 -05:00
test_gp2rs.py fix(gp2rs): write beat times at 6-decimal precision so imported tempo matches Guitar Pro (#819) 2026-07-10 13:12:10 +02:00
test_gp_audio_sync.py fix(gp8): confine registry asset matching to the declared directory (#1011) 2026-07-19 01:36:28 -05:00
test_gp_autosync_warp.py feat(gp_autosync): piecewise time-warp helpers + refine_sync onset pass (#787) 2026-07-05 20:08:19 +02:00
test_group_filter_law.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_highway_3d_routes.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_highway_ws_authors.py refactor(server): extract the highway WebSocket into routers/ws_highway.py (R3) (#844) 2026-07-10 21:12:54 +02:00
test_highway_ws_instrument_routing.py refactor(server): extract the highway WebSocket into routers/ws_highway.py (R3) (#844) 2026-07-10 21:12:54 +02:00
test_highway_ws_notation.py refactor(server): extract the highway WebSocket into routers/ws_highway.py (R3) (#844) 2026-07-10 21:12:54 +02:00
test_library_filters.py feat(library): sort and badge by personal difficulty rating (#810) 2026-07-07 23:57:20 +02:00
test_library_keyset.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_library_providers.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_library_tuning_instrument.py fix(library): tuning filter answers for your instrument, not always guitar (#1003) 2026-07-19 00:04:30 -05:00
test_library_tuning_perspectives.py fix(library): tuning filter answers for your instrument, not always guitar (#1003) 2026-07-19 00:04:30 -05:00
test_lift_keys_notation.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_logging_setup.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_loops_concurrency.py fix(loops): take the DB lock for the count+insert and the list read (#840) 2026-07-10 19:16:01 +02:00
test_loose_traversal.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_loosefolder.py fix(library): tuning filter answers for your instrument, not always guitar (#1003) 2026-07-19 00:04:30 -05:00
test_lyrics_transcribe_remote.py fix: remote transcription posts to /transcribe, not /align (stem-splitter#17) (#959) 2026-07-14 01:58:24 -04:00
test_lyrics_transcribe.py Purge external-format terminology from code, tests and docs 2026-06-16 19:36:53 +01:00
test_mb_enrichment.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_mb_match.py feat(enrichment): alias-aware scoring — auto-confirm non-Latin-primary artists (#772) 2026-07-05 01:11:38 +02:00
test_midi_import_drums.py feat(drums): capture velocities alongside times in unmapped-percussion reporting (#808) 2026-07-07 23:58:49 +02:00
test_midi_import.py fix(midi): guard non-positive division in the legacy inline tempo path (#805) 2026-07-07 10:27:45 +02:00
test_midi_tempo_map.py feat(midi): convert_midi_tempo_map — extract tempos, time signatures, beat grid (#796) 2026-07-07 10:27:17 +02:00
test_migrate_full_mix_stem.py fix(sloppak): the full mix is a stem — drop the invented original_audio key (#946) 2026-07-13 12:22:42 -04:00
test_minigames_routes.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_notation_lib.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_notation_lift.py feat(notation_lift): authored per-note hands steer the split — heuristic only guesses the rest (#992) 2026-07-19 00:40:08 -05:00
test_notation_to_notes.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_packaging.py fix(build): move appstate.py + routers/ under lib/ so the desktop app ships them (#836) 2026-07-10 17:16:34 +02:00
test_parse_arrangement.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_playlist_cover_errors.py fix(playlists): split cover decode (400) from persist (500), unique temp, existence re-check (#842) 2026-07-10 20:16:22 +02:00
test_playlists_api.py feat(playlists): flag songs that are not in your current tuning (#1009) 2026-07-19 00:10:53 -05:00
test_plugin_context_contract.py test(plugins): pin the plugin_context contract before carving server.py (R3b) (#898) 2026-07-12 00:29:48 +02:00
test_plugin_manifest_contract.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_plugin_runtime_idempotence.py refactor(app): carve the JUCE/desktop audio shims out of app.js (R3a) (#893) 2026-07-11 22:44:03 +02:00
test_plugin_src_route.py fix(plugins): make a module plugin actually re-evaluate on reload (#879) (#897) 2026-07-12 00:19:59 +02:00
test_plugins.py test(plugins): pin the plugin_context contract before carving server.py (R3b) (#898) 2026-07-12 00:29:48 +02:00
test_practice_suggestions.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_profile_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_profile_domains.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_progression_api.py refactor(server): carve builtin-content seeding into lib/builtin_content.py (R3b) (#900) 2026-07-12 00:50:50 +02:00
test_progression.py Purge external-format terminology from code, tests and docs 2026-06-16 19:36:53 +01:00
test_resolved_root_cache.py perf(paths): resolve the library root once, not on every path check (#966) 2026-07-14 19:48:39 +02:00
test_safepath.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_scraper_options.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_settings_api.py refactor(server): carve the library scanner into lib/scan.py (R3b) (#901) 2026-07-12 01:26:02 +02:00
test_settings_export_library_db.py refactor(server): extract the settings routes into routers/settings.py (R3) (#863) 2026-07-11 12:35:05 +02:00
test_settings_export.py refactor(server): extract the settings routes into routers/settings.py (R3) (#863) 2026-07-11 12:35:05 +02:00
test_settings_instrument.py settings: add host instrument profiles (#753) 2026-07-05 00:16:42 +02:00
test_sloppak_cent_offset.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_sloppak_cover_art.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_sloppak_drumtab_load.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_sloppak_feedpak_version.py feat(core): adopt feedpak_version — read on load + stamp on manifest writes (spec §4) (#530) 2026-06-20 21:59:04 +02:00
test_sloppak_file_traversal.py refactor(server): extract the media/file-serving routes into routers/media.py (R3) (#869) 2026-07-11 15:36:22 +02:00
test_sloppak_full_mix_load.py fix(sloppak): the full mix is a stem — drop the invented original_audio key (#946) 2026-07-13 12:22:42 -04:00
test_sloppak_jsonc_load.py feat(core): read .jsonc data files (strip C-style comments) (feedpak-spec §8) 2026-06-20 14:10:04 -07:00
test_sloppak_keys_load.py feat(core): consume keys.json — song-level key/scale track (loader + WS) (#528) 2026-06-20 21:23:48 +02:00
test_sloppak_notation_load.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_sloppak_song_timeline_load.py feat(core): consume song_timeline tempos + time_signatures + per-chart tempos (feedpak 1.2.0) (#529) 2026-06-20 21:35:07 +02:00
test_sloppak_unpack_cache.py fix(sloppak): bound the unpack cache; add read_member_bytes() so callers stop unpacking whole songs (#950) 2026-07-13 17:13:08 +02:00
test_song_info_stems.py feat(song-info): publish the playable stem list so stems can preload (fixes the 698ms freeze) (#972) 2026-07-15 00:36:13 +02:00
test_song_score.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_song_stats_api.py test(stats): prove seconds-only recency on a fresh row (#948) 2026-07-13 15:36:05 +02:00
test_song_user_meta.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_song.py feat(song): per-note keys hand assignment (hand) on the Note wire (#990) 2026-07-19 00:39:27 -05:00
test_songmeta.py fix: Edit Metadata persists into .feedpak files (suffix gate predated the rename) (#725) 2026-07-02 20:51:57 +02:00
test_spec_gate.py ci: cover gap-fill manifest key scans 2026-07-13 13:25:44 +02:00
test_starter_suggestions.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_startup_status.py refactor(server): carve demo mode into lib/demo_mode.py (R3b) (#903) 2026-07-12 01:32:46 +02:00
test_tailwind_rebuild.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_tailwind_runtime_path.py fix(tailwind): stop the dev server rewriting a tracked file (#911) (#918) 2026-07-12 13:25:16 +02:00
test_tones.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_tuning_provider_isolation.py fix(server): a raising tuning provider no longer takes down get_merged() for everyone (#899) (#904) 2026-07-12 01:25:08 +02:00
test_tunings.py Harden freqs_to_midis against NaN/Inf; badges read exact tuningMidis 2026-07-12 15:24:39 -05:00
test_version_endpoint.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_vocal_pitch.py Clean release snapshot 2026-06-16 18:47:13 +02:00
test_wanted_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_work_charts_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_work_grouping.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_ws_highway_disconnect.py fix(ws_highway): swallow a mid-stream WebSocketDisconnect quietly (#845) 2026-07-10 21:30:53 +02:00
test_xp.py Clean release snapshot 2026-06-16 18:47:13 +02:00