@txstate-mws/svelte-components 0.0.66 → 0.0.67

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.
@@ -10,6 +10,7 @@ let className = '';
10
10
  export { className as class };
11
11
  import { onMount, onDestroy, createEventDispatcher, tick } from 'svelte';
12
12
  import { tabbable } from 'tabbable';
13
+ import { sleep } from 'txstate-utils';
13
14
  import { buttonify } from '../actions';
14
15
  import ScreenReaderOnly from './ScreenReaderOnly.svelte';
15
16
  const dispatch = createEventDispatcher();
@@ -18,7 +19,7 @@ let abovelockelement;
18
19
  let active = true;
19
20
  if (initialfocus)
20
21
  hidefocus = false;
21
- onMount(() => {
22
+ onMount(async () => {
22
23
  const prevFocusLock = FocusLockStack.slice(-1)[0];
23
24
  if (prevFocusLock)
24
25
  prevFocusLock.pause();
@@ -29,6 +30,7 @@ onMount(() => {
29
30
  if (typeof returnfocusto === 'undefined') {
30
31
  returnfocusto = document.querySelector(':focus');
31
32
  }
33
+ await sleep(1);
32
34
  if (initialfocus) {
33
35
  const focusEl = lockelement.querySelector(initialfocus);
34
36
  if (focusEl instanceof HTMLElement)
@@ -13,6 +13,7 @@
13
13
 
14
14
  import { onMount, onDestroy, createEventDispatcher, tick } from 'svelte'
15
15
  import { tabbable } from 'tabbable'
16
+ import { sleep } from 'txstate-utils'
16
17
  import { buttonify } from '../actions'
17
18
  import ScreenReaderOnly from './ScreenReaderOnly.svelte'
18
19
  const dispatch = createEventDispatcher()
@@ -20,7 +21,7 @@
20
21
  let abovelockelement: HTMLElement
21
22
  let active = true
22
23
  if (initialfocus) hidefocus = false
23
- onMount(() => {
24
+ onMount(async () => {
24
25
  const prevFocusLock = FocusLockStack.slice(-1)[0]
25
26
  if (prevFocusLock) prevFocusLock.pause()
26
27
  FocusLockStack.push({
@@ -30,6 +31,7 @@
30
31
  if (typeof returnfocusto === 'undefined') {
31
32
  returnfocusto = document.querySelector(':focus') as HTMLElement
32
33
  }
34
+ await sleep(1)
33
35
  if (initialfocus) {
34
36
  const focusEl = lockelement.querySelector(initialfocus)
35
37
  if (focusEl instanceof HTMLElement) focusEl.focus()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@txstate-mws/svelte-components",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "description": "Svelte components that are generically useful.",
5
5
  "main": "dist/index.js",
6
6
  "module": "esm/index.js",