Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-cups-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@formwerk/core': patch
---

fix: handle popover state manually closes #200
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { MaybeRefOrGetter, Ref, shallowRef, toValue, watch } from 'vue';
import { MaybeRefOrGetter, onMounted, Ref, shallowRef, toValue, watch } from 'vue';
import { useEventListener } from '../useEventListener';
import { Maybe } from '../../types';

interface ControllerInit {
disabled?: MaybeRefOrGetter<boolean | undefined>;
triggerEl?: MaybeRefOrGetter<Maybe<HTMLElement>>;
}

export function usePopoverController(popoverEl: Ref<Maybe<HTMLElement>>, opts?: ControllerInit) {
Expand All @@ -15,7 +16,7 @@
return;
}

if (value === el.matches(':popover-open')) {

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "tabbing should close the listbox". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing ArrowUp should Move focus through the options backwards and stays at the top". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing PageDown should Move focus to the first option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing PageUp should Move focus to the first option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing Home should Move focus to the first option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing End should Move focus to the last option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing ArrowDown should Move focus through the options and stays at the bottom". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Clicking the trigger should open the listbox and have focus on first option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing Enter should open the listbox and have focus on first option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 19 in packages/core/src/helpers/usePopoverController/usePopoverController.ts

View workflow job for this annotation

GitHub Actions / tests

Unhandled error

SyntaxError: unknown pseudo-class selector ':popover-open' ❯ emit node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:669:17 ❯ compileSelector node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1441:17 ❯ compile node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:856:16 ❯ match_collect node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1497:16 ❯ Object._matches [as match] node_modules/.pnpm/[email protected]/node_modules/nwsapi/src/nwsapi.js:1560:35 ❯ HTMLDivElementImpl.ElementImpl.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:596:18 ❯ HTMLDivElement.matches node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34 ❯ packages/core/src/helpers/usePopoverController/usePopoverController.ts:19:22 ❯ callWithErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19 ❯ callWithAsyncErrorHandling node_modules/.pnpm/@VUE[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:207:17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 } This error originated in "packages/core/src/useSelect/useSelect.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "Pressing space should open the listbox and have focus on first option". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
return;
}

Expand Down Expand Up @@ -43,6 +44,37 @@
},
);

// Click outside listener
useEventListener(
window,
'click',
(e: MouseEvent) => {
if (e.target instanceof HTMLElement) {
if (popoverEl.value?.contains(e.target)) {
return;
}

const triggerEl = toValue(opts?.triggerEl);
if (triggerEl?.contains(e.target)) {
return;
}
}

isOpen.value = false;
},
{ disabled: () => toValue(opts?.disabled) || !isOpen.value },
);

useEventListener(opts?.triggerEl, ['focus'], () => {
isOpen.value = true;
});

onMounted(() => {
if (popoverEl.value) {
popoverEl.value.popover = 'manual';
}
});

return {
isOpen,
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/useComboBox/useComboBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
label: props.label,
multiple: false,
orientation: props.orientation,
triggerEl: inputEl,
isValueSelected: value => {
return isEqual(fieldValue.value, value);
},
Expand All @@ -181,7 +182,7 @@
}

// If an option was clicked, then it would blur the field and so we want to select the clicked option via the `relatedTarget` property.
let relatedTarget = (evt as any).relatedTarget as HTMLElement | null;

Check warning on line 185 in packages/core/src/useComboBox/useComboBox.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
if (relatedTarget) {
relatedTarget = relatedTarget.closest('[role="option"]') as HTMLElement | null;
const opt = renderedOptions.value.find(opt => opt.id === relatedTarget?.id);
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/useListBox/useListBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ListBoxProps<TOption, TValue = TOption> {
orientation?: Orientation;
disabled?: boolean;
autofocusOnOpen?: boolean;
triggerEl?: Maybe<HTMLElement>;

onToggleAll?(): void;
onToggleBefore?(): void;
Expand Down Expand Up @@ -76,7 +77,7 @@ export function useListBox<TOption, TValue = TOption>(
const finder = useBasicOptionFinder(renderedOptions);

// Initialize popover controller, NO-OP if the element is not a popover-enabled element.
const { isOpen } = usePopoverController(listBoxEl, { disabled: props.disabled });
const { isOpen } = usePopoverController(listBoxEl, { disabled: props.disabled, triggerEl: props.triggerEl });
const isShiftPressed = useKeyPressed(['ShiftLeft', 'ShiftRight'], () => !isOpen.value);
const isMetaPressed = useKeyPressed(
isMac() ? ['MetaLeft', 'MetaRight'] : ['ControlLeft', 'ControlRight'],
Expand Down
98 changes: 6 additions & 92 deletions packages/playground/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,99 +1,13 @@
<script setup lang="ts">
import { useStepFormFlow } from '@formwerk/core';
import InputText from './components/InputText.vue';
import InputTextArea from './components/InputTextArea.vue';
import z from 'zod';

const {
formProps,
nextButtonProps,
previousButtonProps,
onDone,
isLastStep,
FormStep,
goToStep,
isCurrentStep,
getStepValue,
onBeforeStepResolve,
} = useStepFormFlow({});

onBeforeStepResolve(ctx => {
if (ctx.currentStep.name === 'step-1' && ctx.values.name === 'ahmad') {
return 'step-3';
}

return ctx.next();
});

const step1 = z.object({
name: z.string(),
email: z.string().email(),
});

const step2 = z.object({
address: z.string(),
});

onDone(data => {
console.log(data.toObject());
});
import ComboBox from './components/ComboBox.vue';
import OptionItem from './components/OptionItem.vue';
</script>

<template>
<form v-bind="formProps" class="w-full h-full flex flex-col items-center justify-center">
<div class="flex gap-2 my-8">
<button
type="button"
class="bg-gray-700 p-2 rounded-full aria-selected:bg-emerald-500 hover:bg-gray-500"
:aria-selected="isCurrentStep(0)"
@click="goToStep(0)"
>
Go to step 1
</button>
<button
type="button"
class="bg-gray-700 p-2 rounded-full aria-selected:bg-emerald-500 hover:bg-gray-500"
:aria-selected="isCurrentStep(1)"
@click="goToStep(1)"
>
Go to step 2
</button>
<button
type="button"
class="bg-gray-700 p-2 rounded-full aria-selected:bg-emerald-500 hover:bg-gray-500"
:aria-selected="isCurrentStep(2)"
@click="goToStep(2)"
>
Go to step 3
</button>
</div>

<FormStep name="step-1" :schema="step1">
{{ getStepValue(0) }}

<InputText name="name" label="Name" />
<InputText name="email" label="Email" />
</FormStep>

<FormStep name="step-2" :schema="step2">
{{ getStepValue(1) }}

<InputTextArea name="address" label="Address" />
</FormStep>

<FormStep name="step-3">
{{ getStepValue(2) }}

<InputText name="city" label="City" />
</FormStep>

<div class="mt-10 grid grid-cols-2 gap-4">
<button class="bg-gray-700 p-2 rounded-md" v-bind="previousButtonProps">⬅️ Previous</button>
<button class="bg-gray-700 p-2 rounded-md" v-bind="nextButtonProps">
{{ isLastStep ? 'Submit' : 'Next ➡️' }}
</button>
</div>
</form>
<ComboBox label="test">
<OptionItem label="TEST" value="1" />
<OptionItem label="TEST2" value="2" />
</ComboBox>
</template>

<style>
Expand Down
Loading