mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 18:17:56 -05:00
fix(a11y): off switches and empty checkboxes reach 3:1 with Accessibility Mode on (#35466)
This commit is contained in:
3 files changed
+21
-5
No files matched your search
@@ -1063,6 +1063,10 @@ html.high-contrast.dark
|
||||
background-color: var(--color-base-800) !important;
|
||||
}
|
||||
|
||||
html.high-contrast:not(.dark) input[type='checkbox']:not(:checked) {
|
||||
border-color: var(--color-base-600);
|
||||
}
|
||||
|
||||
/* Accessibility Mode: the lightest muted pair, 1.58:1 in light and 2.14:1 in dark.
|
||||
text-base-400/70 is an icon colour, so 1.4.11 governs it, and 2.07:1 misses that too. */
|
||||
@layer utilities {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { settings } from '$lib/stores';
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let state = 'unchecked';
|
||||
@@ -15,10 +16,14 @@
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="focus-ring outline -outline-offset-1 outline-[1.5px] outline-base-200 dark:outline-base-600 {state !==
|
||||
'unchecked'
|
||||
class="focus-ring outline -outline-offset-1 outline-[1.5px] {state === 'unchecked' &&
|
||||
($settings?.highContrastMode ?? false)
|
||||
? 'outline-base-600'
|
||||
: 'outline-base-200'} dark:outline-base-600 {state !== 'unchecked'
|
||||
? 'bg-base-1000 outline-base-1000 '
|
||||
: 'hover:outline-base-500 hover:bg-base-50 dark:hover:bg-base-800'} text-white transition-all rounded-sm inline-block w-3.5 h-3.5 relative {disabled
|
||||
: ($settings?.highContrastMode ?? false)
|
||||
? 'hover:bg-base-50 dark:hover:bg-base-800'
|
||||
: 'hover:outline-base-500 hover:bg-base-50 dark:hover:bg-base-800'} text-white transition-all rounded-sm inline-block w-3.5 h-3.5 relative {disabled
|
||||
? disabledClassName
|
||||
: ''}"
|
||||
on:click={() => {
|
||||
|
||||
@@ -41,14 +41,21 @@
|
||||
class="focus-ring relative h-4 min-h-4 w-7 shrink-0 cursor-pointer rounded-full mx-[0.0625rem] transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-50 {($settings?.highContrastMode ??
|
||||
false)
|
||||
? 'focus:outline focus:outline-2 focus:outline-base-800! focus:dark:outline-base-200!'
|
||||
: ''} {state ? 'bg-base-900 dark:bg-base-0' : 'bg-base-300 dark:bg-base-700'}"
|
||||
: ''} {state
|
||||
? 'bg-base-900 dark:bg-base-0'
|
||||
: ($settings?.highContrastMode ?? false)
|
||||
? 'bg-base-600 dark:bg-base-500'
|
||||
: 'bg-base-300 dark:bg-base-700'}"
|
||||
onCheckedChange={async () => {
|
||||
await tick();
|
||||
dispatch('change', state);
|
||||
}}
|
||||
>
|
||||
<Switch.Thumb
|
||||
class="pointer-events-none absolute top-[0.125rem] block h-3 w-3 shrink-0 rounded-full transition-all duration-150 data-[state=checked]:left-[0.875rem] data-[state=checked]:bg-base-0 data-[state=checked]:dark:bg-base-1000 data-[state=unchecked]:left-[0.125rem] data-[state=unchecked]:bg-base-0 data-[state=unchecked]:dark:bg-base-500"
|
||||
class="pointer-events-none absolute top-[0.125rem] block h-3 w-3 shrink-0 rounded-full transition-all duration-150 data-[state=checked]:left-[0.875rem] data-[state=checked]:bg-base-0 data-[state=checked]:dark:bg-base-1000 data-[state=unchecked]:left-[0.125rem] data-[state=unchecked]:bg-base-0 {($settings?.highContrastMode ??
|
||||
false)
|
||||
? 'data-[state=unchecked]:dark:bg-base-900'
|
||||
: 'data-[state=unchecked]:dark:bg-base-500'}"
|
||||
/>
|
||||
</Switch.Root>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user