Commit 3b1eb97
fix(Drawer): bounce on drag-release in Default + 4 position variants
The Default story and the 4 Position variants all reproduced the same
animation-restart bug that the Snap Points variant had:
Cause 1: CSS \`animation: none\` on \`[data-swiping]\`
During drag, the \`[data-swiping]\` rule set \`animation: none\`,
transitioning animation-name from e.g. \`drawer-slide-bottom-in\` to
\`none\`. When data-swiping was removed on release, animation-name
went BACK to \`drawer-slide-bottom-in\` — which the browser interprets
as a brand-new animation declaration and restarts from keyframe 0.
The drawer visibly bounced to its off-screen start position
(translateY(100%), translateY(-100%), translateX(-100%),
translateX(100%)) and then slid all the way back after every drag
release.
Cause 2: Keyframes animated \`transform\`
The existing keyframes used \`transform: translateY(100%)\` etc, which
is the same CSS property used to apply the drag offset. Even without
cause 1, any keyframe running on top of the drag would clobber the
inline transform for its duration.
Fix (ported from the earlier Snap Points fix):
- Rewrite all 8 slide keyframes to animate the independent \`translate\`
CSS property instead of \`transform\`, so they compose with the inline
\`transform\` on the popup.
- Drop \`animation: none\` from the \`[data-swiping]\` overrides for all
5 position/default variants. The enter animation is inert within
450ms of mount, so there's no reason to suppress it during drag.
We only need to zero transition-duration so the transform transition
doesn't fight the raw pointer delta.
- Delete the duplicate \`<style>\` block from \`_Drawer.vue\` (it had its
own copy of the buggy keyframe + the \`animation: none\` rule). The
Default variant now inherits from \`Drawer.story.vue\`'s global styles
like every other variant, so the fix lives in exactly one place.
Verified with raf-level instrumentation in histoire at 400x800 for
both the Default (bottom) and Position-Top variants:
Default + small downward drag to +20px:
dt=1023 end-of-drag: y=616, transform=translateY(20), tDur=0s
dt=1197 first release frame: y=616, transform=translateY(20),
tDur=0.45s <-- starts exactly where drag ended
dt=1205: translateY(19.15)
dt=1213: translateY(18.23)
...smooth interpolation to translateY(0)
Position-Top + small upward drag:
y=0 -> drag -15px -> release -> settles at translateY(0) cleanly
44/44 tests still passing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent bf4a39b commit 3b1eb97
File tree
2 files changed
+37
-87
lines changed- packages/core/src/Drawer/story
2 files changed
+37
-87
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
515 | 522 | | |
516 | 523 | | |
517 | 524 | | |
| |||
736 | 743 | | |
737 | 744 | | |
738 | 745 | | |
739 | | - | |
| 746 | + | |
740 | 747 | | |
741 | 748 | | |
742 | 749 | | |
| |||
763 | 770 | | |
764 | 771 | | |
765 | 772 | | |
766 | | - | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
767 | 778 | | |
768 | 779 | | |
769 | 780 | | |
| |||
789 | 800 | | |
790 | 801 | | |
791 | 802 | | |
792 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
793 | 808 | | |
794 | 809 | | |
795 | 810 | | |
| |||
815 | 830 | | |
816 | 831 | | |
817 | 832 | | |
818 | | - | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
819 | 838 | | |
820 | 839 | | |
821 | 840 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
0 commit comments