File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-collapsed" ,
3
- "version" : " 1.3.2 " ,
3
+ "version" : " 1.3.3 " ,
4
4
"private" : false ,
5
5
"description" : " Dynamic CSS height transition from any to auto and vice versa for Vue 3. Accordion ready." ,
6
6
"keywords" : [
Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ onMounted(() => {
137
137
// Collapse / Expand handler
138
138
139
139
watch (isExpanded , (isExpanding ) => {
140
+ if (! collapseRef .value ) return
141
+
140
142
if (isExpanding ) {
141
143
if (isReducedOrDisabled (collapseRef )) return onExpanded ()
142
144
@@ -161,7 +163,11 @@ watch(isExpanded, (isExpanding) => {
161
163
})
162
164
163
165
requestAnimationFrame (() => {
166
+ /** If for any unknown edge case the scrollHeight === 0, abort transition and force expand */
167
+ if (collapseRef .value ! .scrollHeight === 0 ) return onExpanded ()
168
+
164
169
/** Set height to scrollHeight and trigger the transition. */
170
+
165
171
addStyles ({
166
172
... getHeightProp (collapseRef ),
167
173
... getTransitionProp (collapseRef ),
@@ -186,6 +192,9 @@ watch(isExpanded, (isExpanding) => {
186
192
... getHeightProp (collapseRef ),
187
193
})
188
194
195
+ /** Same as for expand, abort transition and force collapse */
196
+ if (collapseRef .value .scrollHeight === 0 ) return onCollapsed ()
197
+
189
198
requestAnimationFrame (() => {
190
199
/** Set height to baseHeight and trigger the transition. */
191
200
addStyles ({
You can’t perform that action at this time.
0 commit comments