From f154b2f870d3e3b3dba0e0314daea3e7d3391e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Wed, 19 Apr 2023 19:07:31 +0200 Subject: [PATCH] fix(theme-common): fix collapsible component with prefers-reduced-motion (#8906) --- .../src/components/Collapsible/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx b/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx index ca0da9d02a..31c4f679e4 100644 --- a/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx +++ b/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx @@ -77,7 +77,9 @@ https://github.com/mui-org/material-ui/blob/e724d98eba018e55e1a684236a2037e24bcf */ function getAutoHeightDuration(height: number) { if (userPrefersReducedMotion()) { - return 0; + // Not using 0 because it prevents onTransitionEnd to fire and bubble up :/ + // See https://github.com/facebook/docusaurus/pull/8906 + return 1; } const constant = height / 36; return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);