Fixing animation bugs

This commit is contained in:
Jake Archibald
2018-10-27 14:40:52 +01:00
parent ac4f845d8e
commit c8e0c56687
2 changed files with 11 additions and 3 deletions

View File

@@ -22,6 +22,9 @@ async function close(content: HTMLElement) {
content.removeAttribute('expanded');
content.setAttribute('aria-expanded', 'false');
// Wait a microtask so other calls to open/close can get the final sizes.
await null;
await transitionHeight(content, {
from,
to: 0,
@@ -37,8 +40,13 @@ async function open(content: HTMLElement) {
content.setAttribute('expanded', '');
content.setAttribute('aria-expanded', 'true');
const to = content.getBoundingClientRect().height;
// Wait a microtask so other calls to open/close can get the final sizes.
await null;
await transitionHeight(content, {
from,
from, to,
duration: 300,
});