Skip to content

Commit 41a9789

Browse files
samejrclaude
andcommitted
fix(webapp): stop the contrast label sticking, tighten the theme picker
The value label above the contrast handle is now purely hover-driven: it was also keyed off focus, which the thumb keeps after a click, leaving the label stuck on once clicked. The handle itself grows from 12px to 18px. Also halves the profile page theme picker and its popover, which was held open by a 180px floor, brightens its icons and labels, and widens the Appearance submenu to 144px. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 54939fe commit 41a9789

3 files changed

Lines changed: 22 additions & 14 deletions

File tree

apps/webapp/app/components/navigation/AppearanceMenuItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export function AppearanceMenuItem() {
3535
: rootData.themePreference;
3636

3737
return (
38-
// Half the standard submenu width: three short labels don't need the room.
39-
<SideMenuPopoverSubMenu title="Appearance" icon={ToggleSwitchIcon} contentClassName="min-w-32">
38+
// Much narrower than the standard submenu: these labels don't need the room.
39+
<SideMenuPopoverSubMenu title="Appearance" icon={ToggleSwitchIcon} contentClassName="min-w-36">
4040
<div className="flex flex-col gap-1 p-1">
4141
{THEME_OPTIONS.map((option) => (
4242
<PopoverMenuItem

apps/webapp/app/components/primitives/Slider.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const variants = {
1212
root: "h-4 grow",
1313
track: "h-1 bg-grid-bright",
1414
range: "bg-transparent",
15-
// Matches the Switch thumb; the secondary-button hairline+shadow keeps the
16-
// white dot visible on the light track
15+
// The secondary-button hairline+shadow keeps the white dot visible on the
16+
// light track
1717
thumb:
18-
"h-3 w-3 border border-border-bright bg-white shadow-sm dark:border-transparent dark:bg-charcoal-200 dark:shadow-none",
18+
"h-4.5 w-4.5 border border-border-bright bg-white shadow-sm dark:border-transparent dark:bg-charcoal-200 dark:shadow-none",
1919
},
2020
tertiary: {
2121
container: "h-6 gap-1 rounded-sm hover:bg-background-raised px-1",
@@ -35,9 +35,9 @@ export type SliderProps = ComponentProps<typeof RadixSlider.Root> & {
3535
TrailingIcon?: RenderIcon;
3636
variant: VariantName;
3737
/**
38-
* Opts into a small label above the thumb showing the formatted value, while
39-
* hovering, dragging, or focused via the keyboard. It sits inside the thumb,
40-
* so it tracks the handle exactly. Reads the controlled `value`, so pass one.
38+
* Opts into a small label above the thumb showing the formatted value, shown
39+
* while the thumb is hovered or being dragged. It sits inside the thumb, so it
40+
* tracks the handle exactly. Reads the controlled `value`, so pass one.
4141
*/
4242
valueTooltip?: (value: number) => string;
4343
};
@@ -95,9 +95,9 @@ export function Slider({
9595
<span
9696
className={cn(
9797
"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded border border-grid-bright bg-background-bright px-1.5 py-0.5 text-xs tabular-nums text-text-bright shadow-md transition-opacity",
98-
isDragging
99-
? "opacity-100"
100-
: "opacity-0 group-hover/thumb:opacity-100 group-focus-visible/thumb:opacity-100"
98+
// Deliberately not keyed off focus: the thumb keeps focus after a
99+
// click, which would leave the label stuck on.
100+
isDragging ? "opacity-100" : "opacity-0 group-hover/thumb:opacity-100"
101101
)}
102102
>
103103
{valueTooltip(currentValue)}

apps/webapp/app/routes/account._index/route.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const meta = pageMeta("Your profile");
4444

4545
function themeIcon(value: ThemePreference) {
4646
const Icon = THEME_OPTIONS_BY_VALUE[value].icon;
47-
return <Icon className="size-4 text-text-dimmed" />;
47+
return <Icon className="size-4 text-text-bright" />;
4848
}
4949

5050
function createSchema(
@@ -305,11 +305,19 @@ export default function Page() {
305305
{THEME_OPTIONS_BY_VALUE[value].label}
306306
</span>
307307
)}
308-
className="w-44"
308+
className="w-22"
309+
// The popover's 180px floor left a gap past the longest
310+
// label; track the trigger's width instead.
311+
popoverClassName="min-w-22"
309312
>
310313
{(items) =>
311314
items.map((item) => (
312-
<SelectItem key={item} value={item} icon={themeIcon(item)}>
315+
<SelectItem
316+
key={item}
317+
value={item}
318+
icon={themeIcon(item)}
319+
className="text-text-bright"
320+
>
313321
{THEME_OPTIONS_BY_VALUE[item].label}
314322
</SelectItem>
315323
))

0 commit comments

Comments
 (0)