@abhivarde/svelte-drawer 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -189,19 +189,17 @@
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
let contentInnerRef = $state<HTMLElement | null>(null);
|
|
193
|
-
let measuredHeight = $state<number | null>(null);
|
|
194
|
-
|
|
195
192
|
$effect(() => {
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
193
|
+
if (drawer.open && trapFocus && contentElement) {
|
|
194
|
+
tick().then(() => {
|
|
195
|
+
const focusable = getFocusableElements();
|
|
196
|
+
if (focusable[0]) {
|
|
197
|
+
focusable[0].focus({ preventScroll: true });
|
|
198
|
+
} else {
|
|
199
|
+
contentElement?.focus({ preventScroll: true });
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
205
203
|
});
|
|
206
204
|
|
|
207
205
|
onMount(() => {
|
|
@@ -216,9 +214,8 @@
|
|
|
216
214
|
<div
|
|
217
215
|
bind:this={contentElement}
|
|
218
216
|
class={className}
|
|
219
|
-
style="transform: {getTransform()}; z-index: 50; touch-action: none;{autoHeight
|
|
220
|
-
|
|
221
|
-
? ` height: ${measuredHeight}px; transition: height 0.25s cubic-bezier(0.4,0,0.2,1);`
|
|
217
|
+
style="transform: {getTransform()}; z-index: 50; touch-action: none;{autoHeight
|
|
218
|
+
? ' height: auto;'
|
|
222
219
|
: ''}"
|
|
223
220
|
tabindex="-1"
|
|
224
221
|
role="dialog"
|
|
@@ -227,8 +224,6 @@
|
|
|
227
224
|
ontouchstart={onPointerDown}
|
|
228
225
|
{...restProps}
|
|
229
226
|
>
|
|
230
|
-
|
|
231
|
-
{@render children()}
|
|
232
|
-
</div>
|
|
227
|
+
{@render children()}
|
|
233
228
|
</div>
|
|
234
229
|
{/if}
|