Skip to content

Commit 60c8e0b

Browse files
Adebesin-Cellclaude
andcommitted
fix(brand): use native radio inputs in Customize section
Replace ButtonBase with role="radio" with native <input type="radio"> in labels to satisfy html-validate prefer-native-element, and drop duplicate utility classes already provided by ButtonBase. Add focus-within rings for keyboard visibility. Bind :checked from activeAccentId so the native radio matches the visible swatch even when customAccent is null. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 2cb88dd commit 60c8e0b

1 file changed

Lines changed: 40 additions & 41 deletions

File tree

app/components/Brand/Customize.vue

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -143,24 +143,30 @@ async function downloadCustomPng() {
143143
<span class="text-sm font-mono text-fg-muted shrink-0">{{
144144
$t('brand.customize.accent_label')
145145
}}</span>
146-
<div class="flex items-center gap-1.5" role="radiogroup">
147-
<ButtonBase
146+
<div class="flex items-center gap-1.5">
147+
<label
148148
v-for="color in pickerColors"
149149
:key="color.id"
150-
role="radio"
151-
:aria-checked="activeAccentId === color.id"
152-
:aria-label="color.label"
153-
class="!w-6 !h-6 !rounded-full !border-2 !p-0 !min-w-0 transition-all duration-150 motion-reduce:transition-none"
150+
class="relative w-6 h-6 rounded-full border-2 cursor-pointer duration-150 motion-reduce:transition-none focus-within:ring-2 focus-within:ring-fg focus-within:ring-offset-2 focus-within:ring-offset-bg"
154151
:class="
155152
activeAccentId === color.id
156-
? '!border-fg scale-110'
153+
? 'border-fg scale-110'
157154
: color.id === 'neutral'
158-
? '!border-border hover:!border-border-hover'
159-
: '!border-transparent hover:!border-border-hover'
155+
? 'border-border hover:border-border-hover'
156+
: 'border-transparent hover:border-border-hover'
160157
"
161158
:style="{ backgroundColor: color.value }"
162-
@click="customAccent = color.id"
163-
/>
159+
>
160+
<input
161+
type="radio"
162+
name="brand-customize-accent"
163+
:value="color.id"
164+
:checked="activeAccentId === color.id"
165+
:aria-label="color.label"
166+
class="sr-only"
167+
@change="customAccent = color.id"
168+
/>
169+
</label>
164170
</div>
165171
</fieldset>
166172

@@ -170,40 +176,33 @@ async function downloadCustomPng() {
170176
<span class="text-sm font-mono text-fg-muted">{{
171177
$t('brand.customize.bg_label')
172178
}}</span>
173-
<div
174-
class="flex items-center border border-border rounded-md overflow-hidden"
175-
role="radiogroup"
176-
>
177-
<ButtonBase
178-
size="md"
179-
role="radio"
180-
:aria-checked="customBgDark"
181-
:aria-label="$t('brand.logos.on_dark')"
182-
class="!border-none !rounded-none motion-reduce:transition-none"
183-
:class="
184-
customBgDark
185-
? 'bg-bg-muted text-fg'
186-
: 'bg-transparent text-fg-muted hover:text-fg'
187-
"
188-
@click="customBgDark = true"
179+
<div class="flex items-center border border-border rounded-md overflow-hidden">
180+
<label
181+
class="px-3 py-1.5 text-sm font-mono cursor-pointer motion-reduce:transition-none focus-within:bg-fg/10"
182+
:class="customBgDark ? 'bg-bg-muted text-fg' : 'text-fg-muted hover:text-fg'"
189183
>
184+
<input
185+
v-model="customBgDark"
186+
type="radio"
187+
name="brand-customize-bg"
188+
:value="true"
189+
class="sr-only"
190+
/>
190191
{{ $t('brand.logos.on_dark') }}
191-
</ButtonBase>
192-
<ButtonBase
193-
size="md"
194-
role="radio"
195-
:aria-checked="!customBgDark"
196-
:aria-label="$t('brand.logos.on_light')"
197-
class="!border-none !rounded-none border-is border-is-border motion-reduce:transition-none"
198-
:class="
199-
!customBgDark
200-
? 'bg-bg-muted text-fg'
201-
: 'bg-transparent text-fg-muted hover:text-fg'
202-
"
203-
@click="customBgDark = false"
192+
</label>
193+
<label
194+
class="px-3 py-1.5 text-sm font-mono cursor-pointer border-is border-is-border motion-reduce:transition-none focus-within:bg-fg/10"
195+
:class="!customBgDark ? 'bg-bg-muted text-fg' : 'text-fg-muted hover:text-fg'"
204196
>
197+
<input
198+
v-model="customBgDark"
199+
type="radio"
200+
name="brand-customize-bg"
201+
:value="false"
202+
class="sr-only"
203+
/>
205204
{{ $t('brand.logos.on_light') }}
206-
</ButtonBase>
205+
</label>
207206
</div>
208207
</div>
209208

0 commit comments

Comments
 (0)