Repository navigation
Closed
Labels
Description
What
Three Library screens are missing from two keyboard focus tables, so focus gets stuck.
- Right from the sidebar doesn't return to Local Files. In a build with Local Files (
cargo run --features local-filesand a music directory set), open Library > Local Files and press Left. Focus moves to the sidebar. Now press Right. Nothing happens. On Liked Songs, Albums, Artists, Stats and the other screens, Right puts focus back in the content pane. There is no keyboard way back to the folder list: Enter on the Local Files row doesn't refocus it, it only resets the folder cursor to the top, because the route is already on top of the stack andpush_navigation_stackdoes nothing. You have to open another screen and come back. - Esc, then h or j does nothing on Stats, Playlist Sync and Local Files. Open Stats from the sidebar, press Esc to unfocus the pane, then press h (or Left) or j (or Down). Nothing happens. On Artists, Albums, a playlist, Home or Discover, the same Esc then h moves the hover to the Library sidebar, and j moves it to the playbar. Stats and Playlist Sync need no Spotify session, so you can reproduce this in any build without logging in.
Both come from match lists that name every content block except these. content_active_block_for_route has no RouteId::LocalBrowser arm and falls through to _ => None. The down and left arms of empty::handler don't list ActiveBlock::Stats, ActiveBlock::PlaylistSync or ActiveBlock::LocalBrowser, so those keys hit _ => {}.
Where to look
content_active_block_for_routeinsrc/tui/handlers/common_key_events.rs(lines 104-125). The comment at lines 114-115 already says a missing arm here makes Right from the sidebar silently do nothing.handle_right_event, right below it, is the caller.handlerinsrc/tui/handlers/empty.rs: thedown_eventarm (lines 14-34, block list at 19-29, setsActiveBlock::PlayBar) and theleft_eventarm (lines 46-62, block list at 48-57, setsActiveBlock::Library).handle_escapeinsrc/tui/handlers/mod.rs: the_ =>catch-all at lines 672-674 sets the active block toEmptyand leaveshovered_blockon the screen's own block. That is how you end up inempty::handlerwithhovered_block == ActiveBlock::Stats.RouteId::LocalBrowserandActiveBlock::LocalBrowserinsrc/core/app/route.rs. Neither is behind#[cfg]:RouteId::LocalBrowseronly has#[cfg_attr(not(feature = "local-files"), allow(dead_code))].- The existing tests to copy:
the_playlist_sync_route_focuses_its_block_from_the_sidebarinsrc/tui/handlers/common_key_events.rs,right_from_sidebar_refocuses_stats_contentinsrc/tui/handlers/stats.rs, andon_left_pressinsrc/tui/handlers/empty.rs.
Possible solution
- Add
RouteId::LocalBrowser => Some(ActiveBlock::LocalBrowser),tocontent_active_block_for_route. - Add
| ActiveBlock::Stats | ActiveBlock::PlaylistSync | ActiveBlock::LocalBrowserto both the down arm and the left arm ofempty::handler. - Don't add
#[cfg]to any of the new arms. All six variants exist in every build, and matching on a variant doesn't construct it, so the slim build compiles them. - Don't add
AiDjorFriends. TheAiDjvariants are behind#[cfg(feature = "ai-dj")]andhandle_escapehands Esc toai_dj::handler. Esc on Friends goes tofriends::handler, which pops the route. - Don't touch
handle_escape,push_navigation_stackoropen_local_sourceinsrc/tui/handlers/library.rs. Enter on the row of the screen that's already open doesn't refocus on any screen. That's a separate, broader behavior, and Right is the fix here. - Mouse support for Local Files is out of scope, so leave
src/tui/handlers/mouse.rsalone.handle_content_table_mousealso callscontent_active_block_for_route, butcontent_table_item_counthas noLocalBrowserarm and returns 0, so the mouse behaves the same as it does today. - Tests. All of these run in the slim build, and
App::default()is enough because none of them needs an IoEvent receiver:- In the
mod testsofsrc/tui/handlers/common_key_events.rs, next to the Playlist Sync one:the_local_files_route_focuses_its_block_from_the_sidebar, assertingcontent_active_block_for_route(&RouteId::LocalBrowser) == Some(ActiveBlock::LocalBrowser). - In the
mod testsofsrc/tui/handlers/local_browser.rs:right_from_sidebar_refocuses_local_files_content, modeled on the Stats test. PushRouteId::LocalBrowserwithActiveBlock::LocalBrowser, callhandler(Key::Left, &mut app), thencommon_key_events::handle_right_event(&mut app), and assert the active block isActiveBlock::LocalBrowser. You'll need to importActiveBlockandRouteIdfromcrate::core::app. - In the
mod testsofsrc/tui/handlers/empty.rs:an_unfocused_stats_screen_moves_left_to_the_sidebarandan_unfocused_stats_screen_moves_down_to_the_playbar. Callapp.set_current_route_state(Some(ActiveBlock::Empty), Some(ActiveBlock::Stats)), sendKey::Left(orKey::Down), and asserthovered_blockisActiveBlock::Library(orActiveBlock::PlayBar). Loop over[ActiveBlock::Stats, ActiveBlock::PlaylistSync, ActiveBlock::LocalBrowser]in each test so all three are covered.
- In the
- Name tests as behavior sentences with no
test_prefix (seeAGENTS.md, Testing conventions). - Leave
tools/gates.countalone, new tests need no counter change. The fix only goes throughset_current_route_state, so no coupling counter moves.
Done when
cargo test --no-default-features --features telemetry,tui local_filesandcargo test --no-default-features --features telemetry,tui unfocusedlist your new tests, and they pass. A filter that matches nothing still exits 0, so check theN filtered outcount.- With
cargo run --features local-files: Local Files, Left, Right puts focus back on the folder list. In any build: Stats, Esc, h moves the hover to the sidebar, and Esc, j moves it to the playbar. cargo fmt --all -- --check,cargo clippy --no-default-features --features telemetry,tui -- -D warningsandcargo test --no-default-features --features telemetry,tuipass. CI's clippy only covers the bin target, socargo testis what compiles your tests.
Metadata
Metadata
Assignees
Labels
Type
Fields
No fields configured for issues without a type.
Activity
spotatui commentedon Sep 29, 2026
🎧 spotatui triage
Auto-triaged with DeepSeek V4-Flash.
Label:
bugLikely area: keyboard focus handling / sidebar navigation
Summary
On three Library screens — Local Files, Stats, and Playlist Sync — keyboard focus gets stuck after certain navigation actions. Pressing Right from the sidebar does not return focus to the Local Files content pane, and after pressing Esc on Stats, Playlist Sync, or Local Files, pressing h/Left or j/Down does nothing instead of moving the hover to the sidebar or playbar. The reporter traces both to missing entries in two keyboard focus tables and proposes adding the missing arms plus tests.
Key points
cargo run --features local-fileswith a music directory setcontent_active_block_for_routeandempty::handlerWhat would help
Possible duplicates: none found
Compared against the 36 most recently updated open issues.