Describe the bug
Happy to switch to the new interactivity API (my code predates that API).
I'm doing a multi-select for a composite aria widget, so when holding down shift key and click an item, it will be selected.
Here is my idea to write the test code, as suggested at testing-library:
const user = userEvent.setup();
await user.keyboard('{Shift>}');
await user.click(thirdItem);
await user.keyboard('{/Shift}');
my code registers a pointerup event, which has this check:
handlePointer(event: PointerEvent, item: Item) {
if (event.shiftKey) {
this.selectShift(item);
}
// ...
}
but when logging the "click" event, the shiftKey property is set to false.
Reproduction
Currently working on a public PR:
Code:
you might wanna put a console.log()/breakpoint at that function.
Setup:
- checkout repo above
pnpm install
cd packages/aria-voyager
pnpm test:ui
- failing test is
tests/listbox/navigation/focus/with-multi-selection.test.ts
System Info
System:
OS: macOS 14.5
CPU: (11) arm64 Apple M3 Pro
Memory: 67.67 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.10.0 - ~/.local/share/mise/installs/node/22/bin/node
npm: 10.9.0 - ~/.local/share/mise/installs/node/22/bin/npm
pnpm: 9.13.2 - ~/.local/share/mise/installs/node/22/bin/pnpm
Watchman: 2024.07.08.00 - /opt/homebrew/bin/watchman
Browsers:
Brave Browser: 103.1.41.100
Chrome: 131.0.6778.86
Edge: 124.0.2478.51
Safari: 17.5
npmPackages:
@vitest/browser: ^2.1.8 => 2.1.8
@vitest/coverage-istanbul: ^2.1.8 => 2.1.8
@vitest/ui: ^2.1.8 => 2.1.8
vite: 5.4.11 => 5.4.11
vitest: ^2.1.8 => 2.1.8
Used Package Manager
pnpm
Validations
Describe the bug
Happy to switch to the new interactivity API (my code predates that API).
I'm doing a multi-select for a composite aria widget, so when holding down shift key and click an item, it will be selected.
Here is my idea to write the test code, as suggested at testing-library:
my code registers a
pointerupevent, which has this check:but when logging the "click" event, the
shiftKeyproperty is set tofalse.Reproduction
Currently working on a public PR:
Code:
you might wanna put a
console.log()/breakpoint at that function.Setup:
pnpm installcd packages/aria-voyagerpnpm test:uitests/listbox/navigation/focus/with-multi-selection.test.tsSystem Info
System: OS: macOS 14.5 CPU: (11) arm64 Apple M3 Pro Memory: 67.67 MB / 36.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.10.0 - ~/.local/share/mise/installs/node/22/bin/node npm: 10.9.0 - ~/.local/share/mise/installs/node/22/bin/npm pnpm: 9.13.2 - ~/.local/share/mise/installs/node/22/bin/pnpm Watchman: 2024.07.08.00 - /opt/homebrew/bin/watchman Browsers: Brave Browser: 103.1.41.100 Chrome: 131.0.6778.86 Edge: 124.0.2478.51 Safari: 17.5 npmPackages: @vitest/browser: ^2.1.8 => 2.1.8 @vitest/coverage-istanbul: ^2.1.8 => 2.1.8 @vitest/ui: ^2.1.8 => 2.1.8 vite: 5.4.11 => 5.4.11 vitest: ^2.1.8 => 2.1.8Used Package Manager
pnpm
Validations