Skip to content

Commit

Permalink
Fix #31 - Update default transition value since Chromium 128
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Aug 5, 2024
1 parent 209e47d commit 747500d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dist
/cypress/screenshots/
.vscode/*
!.vscode/extensions.json
.idea
*.tgz
11 changes: 3 additions & 8 deletions packages/vue-collapsed/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import type { Ref } from 'vue'

type RefEl = Ref<HTMLElement | null>

const isFirefox = () => typeof navigator !== 'undefined' && navigator.userAgent.includes('Firefox')

export function getComputedHeight(el: RefEl) {
if (!el.value) return 0
return parseFloat(getComputedStyle(el.value).height)
Expand All @@ -17,13 +15,10 @@ export function getTransitionProp(el: RefEl) {
const { transition } = getComputedStyle(el.value)

// If transition is not defined via CSS, return the default one referencing the auto duration
if (
transition === 'all 0s ease 0s' ||
(isFirefox() &&
transition ===
'all') /* Since Firefox v124, Gecko returns transition 'all' instead of 'all 0s ease 0s' */
)
if (transition === 'all 0s ease 0s' || transition === 'all') {
/* Since Firefox v124 and Chromium v128, their rendering engine transition computes 'all' instead of 'all 0s ease 0s' */
return { transition: DEFAULT_TRANSITION }
}

return { transition }
}
Expand Down

0 comments on commit 747500d

Please sign in to comment.