diff --git a/.pnp.cjs b/.pnp.cjs index 2b69e57..bda602a 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -32,7 +32,7 @@ const RAW_RUNTIME_STATE = ["@prettier/sync", "virtual:c76842a5689228a0ce1b65e064c1f5e0d5b61e442d08b6527a3b1f100ca1f2105e58f5f1435c5a59df3cce3338560737838d99dae36d25b47d20aa50c89d0539#npm:0.5.2"],\ ["@testing-library/jest-dom", "npm:6.4.8"],\ ["@testing-library/preact", "virtual:c76842a5689228a0ce1b65e064c1f5e0d5b61e442d08b6527a3b1f100ca1f2105e58f5f1435c5a59df3cce3338560737838d99dae36d25b47d20aa50c89d0539#npm:3.2.4"],\ - ["@transcend-io/airgap.js-types", "npm:12.6.0"],\ + ["@transcend-io/airgap.js-types", "npm:12.7.0"],\ ["@transcend-io/internationalization", "npm:1.6.0"],\ ["@transcend-io/logger", "npm:1.1.0"],\ ["@transcend-io/type-utils", "npm:1.5.0"],\ @@ -1756,10 +1756,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@transcend-io/airgap.js-types", [\ - ["npm:12.6.0", {\ - "packageLocation": "./.yarn/cache/@transcend-io-airgap.js-types-npm-12.6.0-6d4470c14e-4d22a5b1b7.zip/node_modules/@transcend-io/airgap.js-types/",\ + ["npm:12.7.0", {\ + "packageLocation": "./.yarn/cache/@transcend-io-airgap.js-types-npm-12.7.0-0148ad0fdc-df8d244c63.zip/node_modules/@transcend-io/airgap.js-types/",\ "packageDependencies": [\ - ["@transcend-io/airgap.js-types", "npm:12.6.0"],\ + ["@transcend-io/airgap.js-types", "npm:12.7.0"],\ ["@transcend-io/type-utils", "npm:1.4.2"],\ ["fp-ts", "npm:2.16.9"],\ ["io-ts", "virtual:647270e91e7a3b3be8360975cf4b261fc37aa1becc6251358c91b0bf0733ffddc3f7d7b9c35550155c202696cf87b8999803730126a6d8c46e4270742d944b5d#npm:2.2.21"]\ @@ -1788,7 +1788,7 @@ const RAW_RUNTIME_STATE = ["@prettier/sync", "virtual:c76842a5689228a0ce1b65e064c1f5e0d5b61e442d08b6527a3b1f100ca1f2105e58f5f1435c5a59df3cce3338560737838d99dae36d25b47d20aa50c89d0539#npm:0.5.2"],\ ["@testing-library/jest-dom", "npm:6.4.8"],\ ["@testing-library/preact", "virtual:c76842a5689228a0ce1b65e064c1f5e0d5b61e442d08b6527a3b1f100ca1f2105e58f5f1435c5a59df3cce3338560737838d99dae36d25b47d20aa50c89d0539#npm:3.2.4"],\ - ["@transcend-io/airgap.js-types", "npm:12.6.0"],\ + ["@transcend-io/airgap.js-types", "npm:12.7.0"],\ ["@transcend-io/internationalization", "npm:1.6.0"],\ ["@transcend-io/logger", "npm:1.1.0"],\ ["@transcend-io/type-utils", "npm:1.5.0"],\ diff --git a/.yarn/cache/@transcend-io-airgap.js-types-npm-12.6.0-6d4470c14e-4d22a5b1b7.zip b/.yarn/cache/@transcend-io-airgap.js-types-npm-12.7.0-0148ad0fdc-df8d244c63.zip similarity index 83% rename from .yarn/cache/@transcend-io-airgap.js-types-npm-12.6.0-6d4470c14e-4d22a5b1b7.zip rename to .yarn/cache/@transcend-io-airgap.js-types-npm-12.7.0-0148ad0fdc-df8d244c63.zip index f1bc0d8..9bb40f0 100644 Binary files a/.yarn/cache/@transcend-io-airgap.js-types-npm-12.6.0-6d4470c14e-4d22a5b1b7.zip and b/.yarn/cache/@transcend-io-airgap.js-types-npm-12.7.0-0148ad0fdc-df8d244c63.zip differ diff --git a/package.json b/package.json index f680502..06cc50b 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/transcend-io/consent-manager-ui.git" }, "homepage": "https://github.com/transcend-io/consent-manager-ui", - "version": "4.23.0", + "version": "4.24.0", "license": "MIT", "main": "build/ui", "files": [ @@ -51,7 +51,7 @@ "@prettier/sync": "^0.5.2", "@testing-library/jest-dom": "^6.4.6", "@testing-library/preact": "^3.2.4", - "@transcend-io/airgap.js-types": "^12.6.0", + "@transcend-io/airgap.js-types": "^12.7.0", "@transcend-io/type-utils": "^1.5.0", "@types/jest": "^29.5.12", "@types/node": "^17.0.45", diff --git a/src/components/Main.tsx b/src/components/Main.tsx index 7c838e6..a3fd7cb 100644 --- a/src/components/Main.tsx +++ b/src/components/Main.tsx @@ -77,7 +77,7 @@ export function Main({ const dialogRef = useRef(null); useEffect(() => { if (!isViewStateClosed(viewState) && dialogRef.current) { - const shouldAutofocus = config.autofocus ?? true; + const shouldAutofocus = config?.autofocus !== 'off'; // This setTimeout was necessary for the api triggered states, (DoNotSell|OptOut)Disclosure setTimeout(() => { if (dialogRef.current && shouldAutofocus) { diff --git a/src/hooks/useViewState.ts b/src/hooks/useViewState.ts index 2605099..12baf83 100644 --- a/src/hooks/useViewState.ts +++ b/src/hooks/useViewState.ts @@ -63,8 +63,8 @@ export function useViewState({ eventTarget: EventTarget; /** Element previously focused before our ui modal was opened */ savedActiveElement: HTMLElement | null; - /** Whether to on last focused element on reopen */ - autofocus?: boolean; + /** Whether to on last focused element on reopen: on or off */ + autofocus?: string; }): { /** The current view state */ viewState: ViewState; @@ -137,7 +137,7 @@ export function useViewState({ * very difficult to interact with. We create an element with maximum focus priority and * focus it so that when we delete it the user will be at the start of the focus order * just like if they had freshly loaded the page. */ - const shouldFocus = autofocus ?? true; + const shouldFocus = autofocus !== 'off'; if (savedActiveElement !== null && shouldFocus) { savedActiveElement.focus(); } else { diff --git a/yarn.lock b/yarn.lock index ed6a693..37d1877 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1123,14 +1123,14 @@ __metadata: languageName: node linkType: hard -"@transcend-io/airgap.js-types@npm:^12.6.0": - version: 12.6.0 - resolution: "@transcend-io/airgap.js-types@npm:12.6.0" +"@transcend-io/airgap.js-types@npm:^12.7.0": + version: 12.7.0 + resolution: "@transcend-io/airgap.js-types@npm:12.7.0" dependencies: "@transcend-io/type-utils": "npm:^1.2.0" fp-ts: "npm:^2.16.1" io-ts: "npm:^2.2.21" - checksum: 10/4d22a5b1b77c3b2d03995f142171d69664df31d6212bd2776762a5aa90cb6f2b0bfe44b8d00f3647be1558dab8080348d7cd6800aeee2d510de6b7aa2699a88a + checksum: 10/df8d244c633f0f205c0e2382aaea5da0d5d64fc45d6473bf33a7cccbfc880c0703324b7f37469692f7a4ad3b43d14187cfa9a814c51275d9729e527b815242d6 languageName: node linkType: hard @@ -1155,7 +1155,7 @@ __metadata: "@prettier/sync": "npm:^0.5.2" "@testing-library/jest-dom": "npm:^6.4.6" "@testing-library/preact": "npm:^3.2.4" - "@transcend-io/airgap.js-types": "npm:^12.6.0" + "@transcend-io/airgap.js-types": "npm:^12.7.0" "@transcend-io/internationalization": "npm:^1.6.0" "@transcend-io/logger": "npm:^1.1.0" "@transcend-io/type-utils": "npm:^1.5.0"