fix(theme-common): fix collapsible component with prefers-reduced-motion (#8906)

This commit is contained in:
Sébastien Lorber 2023-04-19 19:07:31 +02:00 committed by GitHub
parent 9c7e29a157
commit f154b2f870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);