Skip to content

Commit 601d364

Browse files
authored
fix(VProgressLinear): render in forced-colors mode (#20112)
fixes #20111
1 parent 288bca3 commit 601d364

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

packages/vuetify/src/components/VProgressLinear/VProgressLinear.sass

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
&--rounded
1414
@include tools.rounded($progress-linear-border-radius)
1515

16+
@media (forced-colors: active)
17+
border: thin solid buttontext
18+
1619
// Elements
1720
.v-progress-linear__background,
1821
.v-progress-linear__buffer
@@ -25,6 +28,11 @@
2528
width: 100%
2629
transition-property: width, left, right
2730
transition: inherit
31+
32+
@media (forced-colors: active)
33+
.v-progress-linear__buffer
34+
background-color: highlight
35+
opacity: $progress-linear-stream-opacity
2836

2937
.v-progress-linear__content
3038
align-items: center
@@ -41,6 +49,9 @@
4149
.v-progress-linear__indeterminate
4250
background: $progress-linear-background
4351

52+
@media (forced-colors: active)
53+
background-color: highlight
54+
4455
.v-progress-linear__determinate
4556
height: inherit
4657
left: 0

packages/vuetify/src/components/VProgressLinear/VProgressLinear.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { makeThemeProps, provideTheme } from '@/composables/theme'
1414

1515
// Utilities
1616
import { computed, Transition } from 'vue'
17-
import { clamp, convertToUnit, genericComponent, propsFactory, useRender } from '@/util'
17+
import { clamp, convertToUnit, genericComponent, IN_BROWSER, propsFactory, useRender } from '@/util'
1818

1919
type VProgressLinearSlots = {
2020
default: { value: number, buffer: number }
@@ -98,6 +98,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
9898
const normalizedValue = computed(() => clamp(parseFloat(progress.value) / max.value * 100, 0, 100))
9999
const isReversed = computed(() => isRtl.value !== props.reverse)
100100
const transition = computed(() => props.indeterminate ? 'fade-transition' : 'slide-x-transition')
101+
const isForcedColorsModeActive = IN_BROWSER && window.matchMedia('(forced-colors: active)').matches
101102

102103
function handleClick (e: MouseEvent) {
103104
if (!intersectionRef.value) return
@@ -165,7 +166,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
165166
<div
166167
class={[
167168
'v-progress-linear__background',
168-
backgroundColorClasses.value,
169+
!isForcedColorsModeActive ? backgroundColorClasses.value : undefined,
169170
]}
170171
style={[
171172
backgroundColorStyles.value,
@@ -179,7 +180,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
179180
<div
180181
class={[
181182
'v-progress-linear__buffer',
182-
bufferColorClasses.value,
183+
!isForcedColorsModeActive ? bufferColorClasses.value : undefined,
183184
]}
184185
style={[
185186
bufferColorStyles.value,
@@ -195,7 +196,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
195196
<div
196197
class={[
197198
'v-progress-linear__determinate',
198-
barColorClasses.value,
199+
!isForcedColorsModeActive ? barColorClasses.value : undefined,
199200
]}
200201
style={[
201202
barColorStyles.value,
@@ -210,7 +211,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
210211
class={[
211212
'v-progress-linear__indeterminate',
212213
bar,
213-
barColorClasses.value,
214+
!isForcedColorsModeActive ? barColorClasses.value : undefined,
214215
]}
215216
style={ barColorStyles.value }
216217
/>

0 commit comments

Comments
 (0)