diff --git a/crates/ui/src/components/data_table.rs b/crates/ui/src/components/data_table.rs index 3e052296aca29e304024a0976a71e49978aee855..43db2ebd3b9fa7053d16a5cd2f3aa2af0c662d2d 100644 --- a/crates/ui/src/components/data_table.rs +++ b/crates/ui/src/components/data_table.rs @@ -958,11 +958,9 @@ impl RenderOnce for Table { }, ); - // For resizable mode, wrap in a horizontal-scroll container - let table_wrapper = div().size_full(); - - if is_resizable { - if let Some(state) = interaction_state.as_ref() { + if let Some(state) = interaction_state.as_ref() { + // Resizable mode: wrap table in a horizontal scroll container first + let content = if is_resizable { let mut h_scroll_container = div() .id("table-h-scroll") .overflow_x_scroll() @@ -971,68 +969,41 @@ impl RenderOnce for Table { .track_scroll(&state.read(cx).horizontal_scroll_handle) .child(table); h_scroll_container.style().restrict_scroll_to_axis = Some(true); - - let outer = table_wrapper.child(h_scroll_container).custom_scrollbars( - Scrollbars::new(ScrollAxes::Horizontal) - .tracked_scroll_handle(&state.read(cx).horizontal_scroll_handle), - window, - cx, - ); - - let scrollbars = state - .read(cx) - .custom_scrollbar - .clone() - .unwrap_or_else(|| Scrollbars::new(ScrollAxes::Both)); - let mut outer = if let Some(list_state) = variable_list_state { - outer.custom_scrollbars( - scrollbars.tracked_scroll_handle(&list_state), - window, - cx, - ) - } else { - outer.custom_scrollbars( - scrollbars.tracked_scroll_handle(&state.read(cx).scroll_handle), - window, - cx, - ) - }; - // Prevent horizontal scroll events from being routed to the vertical axis - // (the overflow_x_scroll added by custom_scrollbars for the H scrollbar would - // otherwise trigger the fallback delta_y = delta.x when overflow.y != Scroll). - outer.style().restrict_scroll_to_axis = Some(true); - - if let Some(interaction_state) = interaction_state.as_ref() { - outer - .track_focus(&interaction_state.read(cx).focus_handle) - .id(("table", interaction_state.entity_id())) - .into_any_element() - } else { - outer.into_any_element() - } + div().size_full().child(h_scroll_container) } else { - table.into_any_element() - } - } else if let Some(interaction_state) = interaction_state.as_ref() { - let scrollbars = interaction_state + table + }; + + // Attach vertical scrollbars (converts Div → Stateful