Skip to content

Commit d1063d4

Browse files
committed
Fix #24 - Add additional undefined transition check for Firefox 124
1 parent af6ddb4 commit d1063d4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/vue-collapsed/src/utils.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import type { Ref } from 'vue'
44

55
type RefEl = Ref<HTMLElement | null>
66

7+
const isFirefox = () => typeof navigator !== 'undefined' && navigator.userAgent.includes('Firefox')
8+
79
export function getComputedHeight(el: RefEl) {
810
if (!el.value) return 0
911
return parseFloat(getComputedStyle(el.value).height)
@@ -20,8 +22,14 @@ export function getTransitionProp(el: RefEl) {
2022

2123
const { transition } = getComputedStyle(el.value)
2224

23-
// If transition is not defined, return the default one
24-
if (transition === 'all 0s ease 0s') return { transition: DEFAULT_TRANSITION }
25+
// If transition is not defined via CSS, return the default one referencing the auto duration
26+
if (
27+
transition === 'all 0s ease 0s' ||
28+
(isFirefox() &&
29+
transition ===
30+
'all') /* Since Firefox v124, Gecko returns transition 'all' instead of 'all 0s ease 0s' */
31+
)
32+
return { transition: DEFAULT_TRANSITION }
2533

2634
return { transition }
2735
}

0 commit comments

Comments
 (0)