Skip to content

Commit

Permalink
fix(VProgressLinear): render in forced-colors mode (#20112)
Browse files Browse the repository at this point in the history
fixes #20111
  • Loading branch information
06b authored Jul 9, 2024
1 parent 288bca3 commit 601d364
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
&--rounded
@include tools.rounded($progress-linear-border-radius)

@media (forced-colors: active)
border: thin solid buttontext

// Elements
.v-progress-linear__background,
.v-progress-linear__buffer
Expand All @@ -25,6 +28,11 @@
width: 100%
transition-property: width, left, right
transition: inherit

@media (forced-colors: active)
.v-progress-linear__buffer
background-color: highlight
opacity: $progress-linear-stream-opacity

.v-progress-linear__content
align-items: center
Expand All @@ -41,6 +49,9 @@
.v-progress-linear__indeterminate
background: $progress-linear-background

@media (forced-colors: active)
background-color: highlight

.v-progress-linear__determinate
height: inherit
left: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { makeThemeProps, provideTheme } from '@/composables/theme'

// Utilities
import { computed, Transition } from 'vue'
import { clamp, convertToUnit, genericComponent, propsFactory, useRender } from '@/util'
import { clamp, convertToUnit, genericComponent, IN_BROWSER, propsFactory, useRender } from '@/util'

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

function handleClick (e: MouseEvent) {
if (!intersectionRef.value) return
Expand Down Expand Up @@ -165,7 +166,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
<div
class={[
'v-progress-linear__background',
backgroundColorClasses.value,
!isForcedColorsModeActive ? backgroundColorClasses.value : undefined,
]}
style={[
backgroundColorStyles.value,
Expand All @@ -179,7 +180,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
<div
class={[
'v-progress-linear__buffer',
bufferColorClasses.value,
!isForcedColorsModeActive ? bufferColorClasses.value : undefined,
]}
style={[
bufferColorStyles.value,
Expand All @@ -195,7 +196,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
<div
class={[
'v-progress-linear__determinate',
barColorClasses.value,
!isForcedColorsModeActive ? barColorClasses.value : undefined,
]}
style={[
barColorStyles.value,
Expand All @@ -210,7 +211,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
class={[
'v-progress-linear__indeterminate',
bar,
barColorClasses.value,
!isForcedColorsModeActive ? barColorClasses.value : undefined,
]}
style={ barColorStyles.value }
/>
Expand Down

0 comments on commit 601d364

Please # to comment.