From f72e70bfcb5d185d9ae4094d9847f128846399ff Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 20 Jun 2026 15:49:25 -0600 Subject: [PATCH] feat(a11y): redundant cues + token badges on SegmentedTabBar Active segment gains a 2px accent underline (non-color shape cue, WCAG 1.4.1) drawn as a non-layout overlay so it never reflows the row, plus an HC-only strong border gated on Theme.is-high-contrast. Count-badge fills move from fixed white washes to Theme.alpha-15/alpha-8 so they follow theme polarity. cc --- .../ui/primitives/SegmentedTabBar.slint | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/qbz-slint/ui/primitives/SegmentedTabBar.slint b/crates/qbz-slint/ui/primitives/SegmentedTabBar.slint index af2880ab0..e27a58199 100644 --- a/crates/qbz-slint/ui/primitives/SegmentedTabBar.slint +++ b/crates/qbz-slint/ui/primitives/SegmentedTabBar.slint @@ -26,6 +26,11 @@ component Segment inherits Rectangle { border-radius: 4px; background: root.active ? Theme.surface-main : ta.has-hover ? Theme.surface-hover : transparent; + // HC-only: a 1px strong border makes the active/inactive distinction + // survive a flattened High-Contrast palette where the fill alone reads + // weakly. Gated so the 31 normal themes keep their clean borderless look. + border-width: (Theme.is-high-contrast && root.active) ? 1px : 0px; + border-color: Theme.border-strong; HorizontalLayout { padding-left: 12px; @@ -49,7 +54,9 @@ component Segment inherits Rectangle { min-width: 18px; height: 16px; border-radius: 8px; - background: root.active ? #ffffff24 : #ffffff14; + // Alpha-token badge fill follows theme polarity (black-on-light + // in light themes) instead of a fixed white wash. + background: root.active ? Theme.alpha-15 : Theme.alpha-8; HorizontalLayout { alignment: center; padding-left: 5px; @@ -66,6 +73,21 @@ component Segment inherits Rectangle { } } + // Redundant non-color shape cue for the active segment (Radix/Spotify + // underline equivalent): a 2px accent bar pinned to the segment's bottom + // edge, shown only when active. Drawn as a non-layout overlay (positioned + // off the Segment root's own geometry, never a sibling .height reference) + // so toggling it never reflows the row. Reads as polish in all 33 themes, + // not just High-Contrast. + if root.active: Rectangle { + x: 4px; + width: root.width - 8px; + height: 2px; + y: root.height - self.height; + border-radius: 1px; + background: Theme.accent; + } + ta := TouchArea { mouse-cursor: pointer; clicked => { root.clicked(); }