-
Notifications
You must be signed in to change notification settings - Fork 52
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
Button - Added additional pointercancel eventlistener #1487
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. This looks like a good addition however according to MDN the pointercancel event can fire for many more reasons and I suspect we would be indiscriminately firing the "up" event.
examples of situations that will trigger a pointercancel event:
- A hardware event occurs that cancels the pointer activities. This may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device.
- The device's screen orientation is changed while the pointer is active.
- The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events.
- The touch-action CSS property prevents the input from continuing.
- When the user interacts with too many simultaneous pointers, the browser can fire this event for all existing pointers (even if the user is still touching the screen).
If we are to include this, i suggest we have a "memory"
Something like:
const activeDownPointers = new Set();
On pointer down
activeDownPointers.add(event.pointerId);
On pointer cancel
if (activeDownPointers.has(event.pointerId)) {
activeDownPointers.delete(event.pointerId);
// call pointer up code
}
Untested
Sounds reasonable ! |
@Steve-Mcl after some initial testing i couldnt figure cases out in which a "random" pointercancel would be emitet. |
TBH, I dont know (not played with this event before - just regurgitating what I seen on MDN) When I get time to pull and test, I will know more. If however in the meantime you decide to play around some more and find it is not necessary, then thats fine too. |
Have you had the chance to add in the |
Description
I just wanted to make pointerevents more reliably end for hmi applications.
So i added the pointercancel event to the button component that activates if the "pointerup" function is enabled.
This will fire when closing the window while a button is pressed or other navigation changes happen that would otherwise not fire the "pointerup" event.
Related Issue(s)
No related issue
Checklist