diff --git a/crates/moon-ui-components/src/moon/data_table.rs b/crates/moon-ui-components/src/moon/data_table.rs index e59be0a..9887864 100644 --- a/crates/moon-ui-components/src/moon/data_table.rs +++ b/crates/moon-ui-components/src/moon/data_table.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, rc::Rc}; use gpui::prelude::FluentBuilder; use gpui::*; -use crate::window_ext::WindowExt as _; +use crate::{ActiveTheme as _, window_ext::WindowExt as _}; use super::{ background::MoonBackgroundPolicy, @@ -1306,7 +1306,7 @@ impl RenderOnce for MoonDataTable { .w_full() .h(px(row_height)) .cursor_pointer() - .hover(|this| this.bg(rgba_from(p.panel_high, 0.28))) + .hover(|this| this.bg(cx.theme().table_hover)) .on_click({ let on_select_row = on_select_row.clone(); move |event, window, cx| { diff --git a/crates/moon-ui-components/src/moon/data_table/tests.rs b/crates/moon-ui-components/src/moon/data_table/tests.rs index 104b7c3..d66b517 100644 --- a/crates/moon-ui-components/src/moon/data_table/tests.rs +++ b/crates/moon-ui-components/src/moon/data_table/tests.rs @@ -186,6 +186,24 @@ fn horizontal_scrollbar_visibility_reaches_the_overlay() { ); } +/// Catches restoring the translucent palette hardcode in the row hover path. That regression makes +/// the hovered Screener row nearly indistinguishable in both themes instead of using the shared, +/// opaque `table_hover` role chosen by the active theme. +#[test] +fn data_table_row_hover_uses_the_semantic_theme_role() { + let source = include_str!("../data_table.rs"); + let implementation = source.split("#[cfg(test)]").next().unwrap_or(source); + + assert!( + implementation.contains(".hover(|this| this.bg(cx.theme().table_hover))"), + "MoonDataTable rows must use the shared table_hover theme role" + ); + assert!( + !implementation.contains(".hover(|this| this.bg(rgba_from(p.panel_high, 0.28)))"), + "MoonDataTable must not weaken row hover with a local translucent palette override" + ); +} + /// Catches replacing `data_table.rs:MoonDataTable` root-owned context-menu dispatch with a local /// child overlay, which would put menus behind neighboring panels and break outside dismissal. #[test]