Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VProgressLinear): render in forced-colors mode #20112

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading