From d04c1038b8de7a689b9094655efb6ecad2c0caa6 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Wed, 11 Nov 2026 20:00:35 +0700 Subject: [PATCH] data: ignore header and footer when content is set --- crates/data/src/sidebar.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/data/src/sidebar.rs b/crates/data/src/sidebar.rs index f7c27d4..fb522d3 100644 --- a/crates/data/src/sidebar.rs +++ b/crates/data/src/sidebar.rs @@ -1,7 +1,7 @@ //! The sidebar: a controlled list with section headers — the Finder //! sidebar's model of rows grouped under non-selectable labels. Custom content -//! can replace the list, leaving a bare container with the header and footer -//! slots around it. +//! replaces the list and takes the whole container; the header and footer +//! slots apply only to the entry list. use std::rc::Rc; @@ -180,7 +180,7 @@ impl Sidebar { self } - /// Pins an element above the body, below nothing else. + /// Pins an element above the list, ignored when content is set. pub fn header(mut self, header: E) -> Self where E: IntoElement, @@ -189,7 +189,7 @@ impl Sidebar { self } - /// Replaces the entries with custom content. + /// Replaces the list with custom content spanning the whole container. pub fn content(mut self, content: E) -> Self where E: IntoElement, @@ -198,7 +198,7 @@ impl Sidebar { self } - /// Pins an element below the body, above nothing else. + /// Pins an element below the list, ignored when content is set. pub fn footer(mut self, footer: E) -> Self where E: IntoElement, @@ -232,6 +232,12 @@ impl RenderOnce for Sidebar { } = self; let custom = content.is_some(); + let (header, footer) = if custom { + (None, None) + } else { + (header, footer) + }; + let label = a11y_label.unwrap_or_else(|| SharedString::from(id.to_string())); let debug_id = id.clone();