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

PEP event just firing every second time #279

Closed
OrellBuehler opened this Issue Apr 22, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@OrellBuehler

OrellBuehler commented Apr 22, 2016

Browser: Google Chrome
Version 49.0.2623.112 m (64-bit)
Example: [http://codepen.io/OrellBuehler/pen/aNjwrG]
PEP-Version: 0.4.1
jQuery: 1.9.1
Event-Type: pointerdown
Description: When you first click on an element with a pointerdown listener then the event gets fired. If you then click on the same element the event doesn't get fired(thats the problem). But if you click beside the element and then on the element the event gets fired again.

@bethge

This comment has been minimized.

Show comment
Hide comment
@bethge

bethge Apr 22, 2016

Member

Thank you for raising this issue and giving an example!

The second pointerdown should certainly get fired.

The alert-popup seems to swallow the mouseup, which PEP uses to maintain the state of currently pressed buttons. On the second click the pointerdown is not triggered because PEP thinks the mouse button is still pressed, since no mouseup event occurred.

As long as you don't call alert-popups from pointerdown listeners, pointerdown should fire events properly.

Member

bethge commented Apr 22, 2016

Thank you for raising this issue and giving an example!

The second pointerdown should certainly get fired.

The alert-popup seems to swallow the mouseup, which PEP uses to maintain the state of currently pressed buttons. On the second click the pointerdown is not triggered because PEP thinks the mouse button is still pressed, since no mouseup event occurred.

As long as you don't call alert-popups from pointerdown listeners, pointerdown should fire events properly.

@scottgonzalez

This comment has been minimized.

Show comment
Hide comment
@scottgonzalez

scottgonzalez Apr 22, 2016

Member

We have to deal with this in jQuery UI too. We have a flag that indicates that the mouse button is being pressed and if we detect a mousedown while this flag is set, we act as if a mouseup just occurred and then continue processing the mousedown. In the jQuery UI case, we only care about the left button, so the code is simpler, but we can take a similar approach in PEP. https://github.com/jquery/jquery-ui/blob/010f5f9d13b7d6f1c13482825547ee95d3033e40/ui/widgets/mouse.js#L82-L83

Seems like this is also related to #219.

Member

scottgonzalez commented Apr 22, 2016

We have to deal with this in jQuery UI too. We have a flag that indicates that the mouse button is being pressed and if we detect a mousedown while this flag is set, we act as if a mouseup just occurred and then continue processing the mousedown. In the jQuery UI case, we only care about the left button, so the code is simpler, but we can take a similar approach in PEP. https://github.com/jquery/jquery-ui/blob/010f5f9d13b7d6f1c13482825547ee95d3033e40/ui/widgets/mouse.js#L82-L83

Seems like this is also related to #219.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment