From a29cd271fc2e200ae51f061ad1bcded973543b87 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Thu, 10 Sep 2026 01:42:48 +0200 Subject: [PATCH] Fix default outlined toggle selected state --- ui-demo/README.md | 2 +- ui-demo/lang/en | 2 +- ui-lib.pl | 4 ++-- unauthenticated/css/ui-lib.css | 7 ------- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/ui-demo/README.md b/ui-demo/README.md index 89bf5f07a..aaefa7fde 100644 --- a/ui-demo/README.md +++ b/ui-demo/README.md @@ -34,7 +34,7 @@ to secondary (gray); primary uses the blue/accent color. Colors follow the theme with built-in fallbacks. Add `outline => 1` for a transparent track with a colored border and thumb. -Secondary uses an outline when off and a soft gray fill when on. The Forms +The track stays unfilled in both positions, including secondary. The Forms tab shows both positions for every outline color. Toggles are compact with softened corners by default. Pass `round => 1` for diff --git a/ui-demo/lang/en b/ui-demo/lang/en index 648630801..bc1769540 100644 --- a/ui-demo/lang/en +++ b/ui-demo/lang/en @@ -110,7 +110,7 @@ index_f_toggle_colors_desc=Checked switches default to secondary. Use primary fo index_f_toggle_primary=Primary index_f_toggle_secondary=Secondary (default) index_f_toggle_outline=Outline toggles -index_f_toggle_outline_desc=Outline tracks use the state color when on. Secondary keeps a soft fill. Click the switches to compare their off and on states. +index_f_toggle_outline_desc=Outline tracks stay unfilled and use the state color for the border and thumb when on. Click the switches to compare their off and on states. index_f_toggle_off=Off index_f_toggle_on=On index_f_toggle_round=Rounded toggles diff --git a/ui-lib.pl b/ui-lib.pl index 960022c62..0c2e92cb3 100755 --- a/ui-lib.pl +++ b/ui-lib.pl @@ -5393,8 +5393,8 @@ are : info or neutral (the default). C aliases danger; secondary, gray and grey alias neutral. Use primary for the theme's blue/accent toggle color. -=item outline - Set to 1 for a bordered track with a matching thumb. Secondary -uses the unchecked track color as a soft fill when on. +=item outline - Set to 1 for a transparent track with a matching border and +thumb, using the state color when on. =item round - Set to 1 for a fully rounded track and thumb. The default is smaller with softened corners. Works with filled and outline styles. diff --git a/unauthenticated/css/ui-lib.css b/unauthenticated/css/ui-lib.css index cb0343eed..41c1ab400 100644 --- a/unauthenticated/css/ui-lib.css +++ b/unauthenticated/css/ui-lib.css @@ -1002,13 +1002,6 @@ a.ui_list_link:hover { color: var(--ui-accent) !important; } color: var(--ui-toggle-bg-checked); background: transparent; } -/* Secondary stays quiet when on, using the normal off-state fill. */ -.ui_toggle_outline.ui_toggle_neutral input:checked ~ .ui_toggle_track, -.ui_toggle_outline.ui_toggle_neutral:has(input:checked) .ui_toggle_track { - color: var(--ui-toggle-thumb); - border-color: var(--ui-toggle-bg); - background: var(--ui-toggle-bg); -} .ui_toggle input:focus-visible ~ .ui_toggle_track, .ui_toggle:has(input:focus-visible) .ui_toggle_track { box-shadow: 0 0 0 3px var(--ui-ring);