Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/moon-ui-components/src/moon/data_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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| {
Expand Down
18 changes: 18 additions & 0 deletions crates/moon-ui-components/src/moon/data_table/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading