New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clickScroll
with pointerType: "pen"
: scroll is aborted if pen leaves scrollbar track
#630
Comments
Good day @tryggvigy :) This seems a bit weird indeed.. The same logic works for mouse and touch devices, so it should also work for pen (at least thats the assumption). I can also confirm the correct behavior with an iPad & Pen. Unfortunately I dont have a wacom device or anything related to that... Do you have any suggestions going forward? - I'm open for anything. |
@tryggvigy I'm not able to test it, but you could play with the |
@tryggvigy I've also found this issue which looks similar to ours: https://stackoverflow.com/questions/59010779/pointer-event-issue-pointercancel-with-pressure-input-pen They suggest to use the css style |
Thank for the pointers @KingSora! I will investigate this more this week. Hopefully i can find a cause/solution. I found someone in the office that borrowed me the pen and i can reproduce so that's a good start :) I'll keep this issue updated if I find something! |
Some new findings:
|
@tryggvigy Thanks for this update! According to MDN I would test the library again without this callback and fix in this way if we don't find a better solution. |
@KingSora removing The only way I've found around the issue is to remove Some things I'm wondering:
Do you think it would be a safe "fix" to stop handling All tests seem to pass with this change - const releasePointerCaptureEvents = 'pointerup pointerleave pointercancel lostpointercapture';
+ const releasePointerCaptureEvents = 'pointerup pointercancel lostpointercapture'; Thank you for engaging with me on this issue! |
I personally think it should be fine to remove the Obviosuly before releasing the fix I would properly test the changes with all input devices I have ( |
great! I'll make a PR to remove perhaps only the Until then I can work around this issue with useEffect(() => {
const track = instance()?.elements().scrollbarVertical.track;
if (!track) return (): void => {};
const handlePointerLeave = (e: PointerEvent): void => {
// On Chromium browsers, pen causes a pointerleave event to be fired
// when the pen leaves the track, this stops click scrolling in
// overlay-scrollbars currently. This works around this chromium bug.
if (pointerType === 'pen') {
e.stopImmediatePropagation();
}
};
track.addEventListener('pointerleave', handlePointerLeave);
return (): void => {
track.removeEventListener('pointerleave', handlePointerLeave);
};
}, [instance, pointerType]); |
@tryggvigy I've decided to include a few other things into the next release, thats why there is no new version yet. I'm confident to have a release this week :) |
Nice! |
Describe the bug
Hey there! We got this bug reported to us, where users using the wacom pen as a mouse input device are having a hard time using the overlay scrollbars. Here is a video demonstrating the issue:
Screen.Recording.2024-04-22.at.15.11.36.mp4
To Reproduce
Steps to reproduce the behavior:
clickScroll: true
"pointerup"
has not fired yetExpected behavior
Scrolling to continue until the user releases the pen
Examples
TODO: I'll add a minimum repro example here asap!
Please create a small example of the bug.
To do this you can use online platforms like JSFiddle, CodeSandbox or StackBlitz. You can also create a separate Github repository which I can clone.
Environment
Additional context
I dug into this a little bit with breakpoints. I can see that
releasePointerCapture
is called differently for pen and mouse.With a mouse it triggers when the mouse button is released as expected:
With a pen, it triggers on
pointerleave
of the.os-scrollbar-track
element, consistent with the bug behaviour.I guess the question is why the second one is being triggered for pen input devices there.
This might be hard to reproduce for maintainers so I'm happy to help. I got my hands on a wacom pen here.
The text was updated successfully, but these errors were encountered: