From 56bb5ef55d4bc03fca89994abb55e6ceb2ea5e47 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 25 May 2024 16:32:15 +0200 Subject: [PATCH 1/2] [Collapse] Bound max transition time --- packages/mui-material/src/styles/createTransitions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mui-material/src/styles/createTransitions.js b/packages/mui-material/src/styles/createTransitions.js index 9f92f9f2d8c4df..a6008519e9ccf5 100644 --- a/packages/mui-material/src/styles/createTransitions.js +++ b/packages/mui-material/src/styles/createTransitions.js @@ -39,8 +39,8 @@ function getAutoHeightDuration(height) { const constant = height / 36; - // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10 - return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10); + // https://www.desmos.com/calculator/vbrp3ggqet + return Math.min(Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10), 3000); } export default function createTransitions(inputTransitions) { From ee4c716d9333f23948cbe22462f98ec25b2b585e Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 25 May 2024 23:30:33 +0200 Subject: [PATCH 2/2] update tests --- packages/mui-material/src/styles/createTransitions.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-material/src/styles/createTransitions.test.js b/packages/mui-material/src/styles/createTransitions.test.js index 1c942fb5a01917..b4cd701b5836c7 100644 --- a/packages/mui-material/src/styles/createTransitions.test.js +++ b/packages/mui-material/src/styles/createTransitions.test.js @@ -145,7 +145,7 @@ describe('createTransitions', () => { zeroHeightDuration = getAutoHeightDuration(0.0001); expect(zeroHeightDuration).to.equal(46); zeroHeightDuration = getAutoHeightDuration(100000); - expect(zeroHeightDuration).to.equal(6685); + expect(zeroHeightDuration).to.equal(3000); }); }); });