rust-windowing / rust-windowing/winit
[Web] found unexpected negative `PointerEvent.pointerId`, but the touch event comes through
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Description
Hello. I get the following error when using touch events on Apple mobile devices.
Here are console logs from when I was testing on iPad:
For every touch event, I get the following errors in the console. Note the intended touch event coming through WindowEvent::PointerButton -> ButtonSource::Touch does get delivered to the fn window_event function of the ApplicationHandler, though it's just spammed with these errors as well.
The line of code causing the error is here:
I tried looking into the W3C spec for PointerEvent.pointerId, and it doesn't give me the impression that this number can't be negative, though I'm not too familiar.
Tested browsers
Safari (newer than listed)
Tested devices
iPhone 12 (18.1.1)
iPad Pro (18.3)
Winit version
The latest master branch, which at the time of this issue is https://github.com/rust-windowing/winit/commit/4d5e68c6e23d9633051ed9c1382eb8bd978751f1.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/platform_impl/web/event.rs at the PointerEvent.pointerId handling linked in the issue. Reproduce the behavior on Safari using an iPhone or iPad touch event, then trace why the negative pointer ID is reported as an error. Done means touch events remain delivered to ApplicationHandler::window_event without the repeated erroneous errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100