The keys list leaves the tab strip and the dock stops ringing
Browse files at this commit7d1dd546804fac0c07ad97bb50305658930646b0Parent: 22a8a53- style
- the keys list leaves the tab strip and the dock stops ringing
2 changed files +62 -35
- crates/app/src/tests/layout.rs +35 -12
- crates/app/src/ui/dock_stance.rs +27 -23
crates/app/src/tests/layout.rsmodified+35 -12
| @@ -2988,31 +2988,54 @@ fn a_dock_ring_never_moves_what_it_rings() { | |||
| 2988 | 4, | 2988 | 4, |
| 2989 | "a dock ring lost its at-rest transparent border" | 2989 | "a dock ring lost its at-rest transparent border" |
| 2990 | ); | 2990 | ); |
| 2991 | + // ...and the focus ring is not painted at all (user 2026-09-09: | ||
| 2992 | + // "clicking through timeline draws a white overlay around the timeline, | ||
| 2993 | + // same happens for library section too"). Keyboard focus is unchanged -- | ||
| 2994 | + // only the paint is gone -- so no dock surface may reach for the focus | ||
| 2995 | + // stroke or for `ink1` on a focused border. | ||
| 2996 | + assert!( | ||
| 2997 | + !dock.contains("STROKE_FOCUS"), | ||
| 2998 | + "a dock surface paints the focus ring again" | ||
| 2999 | + ); | ||
| 3000 | + assert!( | ||
| 3001 | + !dock.contains("is_focused(window)"), | ||
| 3002 | + "a dock surface reads focus for paint again" | ||
| 3003 | + ); | ||
| 3004 | + assert!( | ||
| 3005 | + dock.contains(".track_focus(&player.focus_dock)") | ||
| 3006 | + && dock.contains(".track_focus(&player.focus_inspector)"), | ||
| 3007 | + "dropping the ring's paint took the surface's keyboard focus with it" | ||
| 3008 | + ); | ||
| 2991 | } | 3009 | } |
| 2992 | 3010 | ||
| 2993 | -/// DESIGN §9 as amended 2026-09-09: the keys list is the dock's third tab, | 3011 | +/// DESIGN §9 as amended 2026-09-09: the keys list lives in the dock BODY, |
| 2994 | -/// not a plate over the bench. The overlay the user asked about ("clicking | 3012 | +/// not a plate over the bench and not a tab of its own (user: "remove keys |
| 2995 | -/// them opens a menu ... probably location problem") is gone with its scrim, | 3013 | +/// section from here since we also have it next to ledger"). The strip is |
| 2996 | -/// the tab strip lists all three tabs, and the rows still come off | 3014 | +/// the SOURCES/CLIP pair; the list rides `keys_open` under a KEYS section |
| 2997 | -/// `keys_rows` with the refused ones greyed rather than hidden (§8). | 3015 | +/// head, and the rows still come off `keys_rows` with the refused ones |
| 3016 | +/// greyed rather than hidden (§8). | ||
| 2998 | #[test] | 3017 | #[test] |
| 2999 | -fn the_keys_list_is_a_dock_tab_and_the_plate_is_gone() { | 3018 | +fn the_keys_list_is_dock_body_state_not_a_tab() { |
| 3000 | let stance = src_text("ui/stance.rs"); | 3019 | let stance = src_text("ui/stance.rs"); |
| 3001 | assert!( | 3020 | assert!( |
| 3002 | !stance.contains("keys_overlay") && !stance.contains("stance-keys-overlay"), | 3021 | !stance.contains("keys_overlay") && !stance.contains("stance-keys-overlay"), |
| 3003 | "the keys plate is still mounted over the bench" | 3022 | "the keys plate is still mounted over the bench" |
| 3004 | ); | 3023 | ); |
| 3005 | let dock = src_text("ui/dock_stance.rs"); | 3024 | let dock = src_text("ui/dock_stance.rs"); |
| 3006 | - for (id, label) in [ | 3025 | + for (id, label) in [("dock-tab-src", "SOURCES"), ("dock-tab-clip", "CLIP")] { |
| 3007 | - ("dock-tab-src", "SOURCES"), | ||
| 3008 | - ("dock-tab-clip", "CLIP"), | ||
| 3009 | - ("dock-tab-keys", "KEYS"), | ||
| 3010 | - ] { | ||
| 3011 | assert!( | 3026 | assert!( |
| 3012 | dock.contains(&format!("dock_tab(\"{id}\", \"{label}\"")), | 3027 | dock.contains(&format!("dock_tab(\"{id}\", \"{label}\"")), |
| 3013 | "the dock's tab strip lost {label}" | 3028 | "the dock's tab strip lost {label}" |
| 3014 | ); | 3029 | ); |
| 3015 | } | 3030 | } |
| 3031 | + assert!( | ||
| 3032 | + !dock.contains("dock-tab-keys"), | ||
| 3033 | + "KEYS is still a tab in the strip" | ||
| 3034 | + ); | ||
| 3035 | + assert!( | ||
| 3036 | + dock[dock.find("fn keys_tab(").unwrap()..].contains("section_head(\"KEYS\")"), | ||
| 3037 | + "the keys list draws no KEYS head in the dock body" | ||
| 3038 | + ); | ||
| 3016 | assert!( | 3039 | assert!( |
| 3017 | dock.contains("fn keys_tab(") && dock.contains("keys_rows()"), | 3040 | dock.contains("fn keys_tab(") && dock.contains("keys_rows()"), |
| 3018 | "the KEYS tab draws something other than the action registry" | 3041 | "the KEYS tab draws something other than the action registry" |
| @@ -3023,7 +3046,7 @@ fn the_keys_list_is_a_dock_tab_and_the_plate_is_gone() { | |||
| 3023 | ); | 3046 | ); |
| 3024 | assert!( | 3047 | assert!( |
| 3025 | dock[dock.find("fn keys_tab(").unwrap()..].contains(".overflow_y_scroll()"), | 3048 | dock[dock.find("fn keys_tab(").unwrap()..].contains(".overflow_y_scroll()"), |
| 3026 | - "the KEYS tab does not scroll like its neighbours" | 3049 | + "the keys list does not scroll like its neighbours" |
| 3027 | ); | 3050 | ); |
| 3028 | // The Sources filter box belongs to Sources: it is built inside | 3051 | // The Sources filter box belongs to Sources: it is built inside |
| 3029 | // `sources_tab`, never in the shared frame `render` draws. | 3052 | // `sources_tab`, never in the shared frame `render` draws. |
crates/app/src/ui/dock_stance.rsmodified+27 -23
| @@ -196,15 +196,13 @@ fn dock_tab( | |||
| 196 | .when(active, |d| d.border_t_1().border_color(rgb(INK1()))) | 196 | .when(active, |d| d.border_t_1().border_color(rgb(INK1()))) |
| 197 | .cursor_pointer() | 197 | .cursor_pointer() |
| 198 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 198 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 199 | - // KEYS is a *look*, not a place the room reopens in: it rides | 199 | + // The keys list is body state, not a tab (user 2026-09-09: |
| 200 | - // `keys_open` and is never written to the dock-tab file, so the | 200 | + // "remove keys section from here since we also have it next to |
| 201 | - // pair underneath it (`dock_src_active`) is still what a press on | 201 | + // ledger") -- picking either tab is also the way out of it, and |
| 202 | - // KEYS comes back to. | 202 | + // the pair itself (`dock_src_active`) is what the file keeps. |
| 203 | - this.keys_open = label_text == "KEYS"; | 203 | + this.keys_open = false; |
| 204 | - if !this.keys_open { | 204 | + this.dock_src_active = label_text == "SOURCES"; |
| 205 | - this.dock_src_active = label_text == "SOURCES"; | 205 | + save(this.dock_src_active); |
| 206 | - save(this.dock_src_active); | ||
| 207 | - } | ||
| 208 | cx.notify(); | 206 | cx.notify(); |
| 209 | })) | 207 | })) |
| 210 | .tooltip(crate::ui::widgets::tip_hover(&format!("Show {}", label_text.to_lowercase()), "", None)) | 208 | .tooltip(crate::ui::widgets::tip_hover(&format!("Show {}", label_text.to_lowercase()), "", None)) |
| @@ -912,8 +910,11 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A | |||
| 912 | /// filter, sort chips, rows, IMPORT, hint -- none of it the legacy | 910 | /// filter, sort chips, rows, IMPORT, hint -- none of it the legacy |
| 913 | /// Media/Audio/Text panel `library.rs` draws. That panel's row facts | 911 | /// Media/Audio/Text panel `library.rs` draws. That panel's row facts |
| 914 | /// ([`library_rows`]) are still what every row here is built from. | 912 | /// ([`library_rows`]) are still what every row here is built from. |
| 915 | -fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement { | 913 | +fn sources_tab( |
| 916 | - let focused = player.focus_dock.is_focused(window); | 914 | + player: &Player, |
| 915 | + _window: &mut Window, | ||
| 916 | + cx: &mut Context<Player>, | ||
| 917 | +) -> impl IntoElement { | ||
| 917 | let text_tab = player.library_tab == LibraryTab::Text; | 918 | let text_tab = player.library_tab == LibraryTab::Text; |
| 918 | // Text has no per-stream `Row` to fill -- its rows are subtitle tracks | 919 | // Text has no per-stream `Row` to fill -- its rows are subtitle tracks |
| 919 | // grouped by source ([`subtitle_tab_rows`]), not `library_rows`' files -- | 920 | // grouped by source ([`subtitle_tab_rows`]), not `library_rows`' files -- |
| @@ -986,11 +987,12 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 986 | .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { | 987 | .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { |
| 987 | cycle_on_key_down(Surface::Dock)(this, event, window, cx) | 988 | cycle_on_key_down(Surface::Dock)(this, event, window, cx) |
| 988 | })) | 989 | })) |
| 990 | + // The focus ring is not painted (user 2026-09-09: "clicking through | ||
| 991 | + // timeline draws a white overlay around the timeline, same happens | ||
| 992 | + // for library section too"). The border stays in flow, transparent in | ||
| 993 | + // every state, so keyboard focus still moves and nothing shifts. | ||
| 989 | .border_1() | 994 | .border_1() |
| 990 | - .border_color(match focused { | 995 | + .border_color(gpui::transparent_black()) |
| 991 | - true => rgb(STROKE_FOCUS()).into(), | ||
| 992 | - false => gpui::transparent_black(), | ||
| 993 | - }) | ||
| 994 | .flex_1() | 996 | .flex_1() |
| 995 | .min_h(px(0.)) | 997 | .min_h(px(0.)) |
| 996 | .flex() | 998 | .flex() |
| @@ -1280,10 +1282,9 @@ fn clip_tab( | |||
| 1280 | player: &Player, | 1282 | player: &Player, |
| 1281 | width: f32, | 1283 | width: f32, |
| 1282 | window_size: Size<Pixels>, | 1284 | window_size: Size<Pixels>, |
| 1283 | - window: &mut Window, | 1285 | + _window: &mut Window, |
| 1284 | cx: &mut Context<Player>, | 1286 | cx: &mut Context<Player>, |
| 1285 | ) -> impl IntoElement { | 1287 | ) -> impl IntoElement { |
| 1286 | - let focused = player.focus_inspector.is_focused(window); | ||
| 1287 | // The room actually given here, not the window's: `eq_card_w`/ | 1288 | // The room actually given here, not the window's: `eq_card_w`/ |
| 1288 | // `card_max_w` are asked "how wide may I draw" and answered with the | 1289 | // `card_max_w` are asked "how wide may I draw" and answered with the |
| 1289 | // *whole viewport's* width when handed `window_size` verbatim -- but this | 1290 | // *whole viewport's* width when handed `window_size` verbatim -- but this |
| @@ -1301,11 +1302,12 @@ fn clip_tab( | |||
| 1301 | .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { | 1302 | .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { |
| 1302 | cycle_on_key_down(Surface::Inspector)(this, event, window, cx) | 1303 | cycle_on_key_down(Surface::Inspector)(this, event, window, cx) |
| 1303 | })) | 1304 | })) |
| 1305 | + // The focus ring is not painted (user 2026-09-09: "clicking through | ||
| 1306 | + // timeline draws a white overlay around the timeline, same happens | ||
| 1307 | + // for library section too"). The border stays in flow, transparent in | ||
| 1308 | + // every state, so keyboard focus still moves and nothing shifts. | ||
| 1304 | .border_1() | 1309 | .border_1() |
| 1305 | - .border_color(match focused { | 1310 | + .border_color(gpui::transparent_black()) |
| 1306 | - true => rgb(STROKE_FOCUS()).into(), | ||
| 1307 | - false => gpui::transparent_black(), | ||
| 1308 | - }) | ||
| 1309 | .flex_1() | 1311 | .flex_1() |
| 1310 | .min_h(px(0.)) | 1312 | .min_h(px(0.)) |
| 1311 | .flex() | 1313 | .flex() |
| @@ -1482,6 +1484,9 @@ fn keys_tab(player: &Player) -> impl IntoElement { | |||
| 1482 | .gap(px(3.)) | 1484 | .gap(px(3.)) |
| 1483 | .p(px(8.)) | 1485 | .p(px(8.)) |
| 1484 | .overflow_y_scroll() | 1486 | .overflow_y_scroll() |
| 1487 | + // The list no longer wears a tab, so it says its own name the way | ||
| 1488 | + // every other dock body section does -- MEDIA / IMPORT's head. | ||
| 1489 | + .child(section_head("KEYS")) | ||
| 1485 | .children(keys_rows().into_iter().map(|row| match row { | 1490 | .children(keys_rows().into_iter().map(|row| match row { |
| 1486 | KeyRow::Head(category) => div() | 1491 | KeyRow::Head(category) => div() |
| 1487 | .flex_none() | 1492 | .flex_none() |
| @@ -1543,8 +1548,7 @@ pub(crate) fn render( | |||
| 1543 | .border_b_1() | 1548 | .border_b_1() |
| 1544 | .border_color(rgb(DARK_HAIRLINE())) | 1549 | .border_color(rgb(DARK_HAIRLINE())) |
| 1545 | .child(dock_tab("dock-tab-src", "SOURCES", src_active, cx)) | 1550 | .child(dock_tab("dock-tab-src", "SOURCES", src_active, cx)) |
| 1546 | - .child(dock_tab("dock-tab-clip", "CLIP", !src_active && !keys, cx)) | 1551 | + .child(dock_tab("dock-tab-clip", "CLIP", !src_active && !keys, cx)), |
| 1547 | - .child(dock_tab("dock-tab-keys", "KEYS", keys, cx)), | ||
| 1548 | ) | 1552 | ) |
| 1549 | .child(match (keys, src_active) { | 1553 | .child(match (keys, src_active) { |
| 1550 | (true, _) => keys_tab(player).into_any_element(), | 1554 | (true, _) => keys_tab(player).into_any_element(), |