opencode/patches/@corvu%2Fdrawer@0.2.4.patch
Filip Hejmowski 0cd2e829af fix(app): close mobile drawers dismissed while opening
@corvu/drawer 0.2.4 starts its opening transition two frames after it opens. A dismissal before then slid the drawer open while it was closed. A dismissal in that frame started no transition, or cancelled it, so the transitionend that finishes a close never arrived, leaving focus trapped and body pointer-events disabled. Patch it to skip the late opening step once closed, and to finish a close when no transition is running.

Also stop non-fullscreen story pages from scrolling by 32px inside Storybook's padding. Wait for web fonts before the composer overflow story measures the toolbar. Add composer tests that dismiss the variant drawer before and as it starts opening; both fail without the patch.

The overflow story also waits for focus to return to the add button after Escape before measuring, so the menu focus restore cannot land between select-all and Delete.
2026-10-15 22:11:29 +02:00

50 lines
2.3 KiB
Diff

diff --git a/dist/index.js b/dist/index.js
index c5248382bac4a58b510b48e023e27d14b89c390c..1af906e990bbc637c1100a8e60f8855b93b87687 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -477,6 +477,9 @@ var DrawerRoot = (props) => {
if (_open) {
setTransitionAwareOpen(true);
afterPaint(() => {
+ // A close requested before this frame has already started closing; opening now would slide the drawer in
+ // while it is closed.
+ if (!open()) return;
batch(() => {
setTransitionState("opening");
setActiveSnapPoint(localProps.defaultSnapPoint);
@@ -493,7 +496,9 @@ var DrawerRoot = (props) => {
});
afterPaint(() => {
const transitionDuration = parseFloat(drawerStyles().transitionDuration);
- if (transitionDuration === 0) {
+ // A close that lands before the opening transition has moved the content either starts no transition or
+ // cancels the pending one, so no transitionend arrives to finish it.
+ if (transitionDuration === 0 || !dialogContext().contentRef().getAnimations().length) {
closeDrawer();
}
});
diff --git a/dist/index.jsx b/dist/index.jsx
index fa3ca91ca526e9c11a10819a8bda27dcbb884af7..1c464bcdf757c4a20194d28971c89a179072251b 100644
--- a/dist/index.jsx
+++ b/dist/index.jsx
@@ -567,6 +567,9 @@ var DrawerRoot = (props) => {
if (_open) {
setTransitionAwareOpen(true);
afterPaint(() => {
+ // A close requested before this frame has already started closing; opening now would slide the drawer in
+ // while it is closed.
+ if (!open()) return;
batch2(() => {
setTransitionState("opening");
setActiveSnapPoint(localProps.defaultSnapPoint);
@@ -587,7 +590,9 @@ var DrawerRoot = (props) => {
const transitionDuration = parseFloat(
drawerStyles().transitionDuration
);
- if (transitionDuration === 0) {
+ // A close that lands before the opening transition has moved the content either starts no transition or
+ // cancels the pending one, so no transitionend arrives to finish it.
+ if (transitionDuration === 0 || !dialogContext().contentRef().getAnimations().length) {
closeDrawer();
}
});