Skip to content
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

Wierd focus bug on input[type=range] #1509

Closed
sathorn6 opened this issue Jan 3, 2015 · 5 comments
Closed

Wierd focus bug on input[type=range] #1509

sathorn6 opened this issue Jan 3, 2015 · 5 comments

Comments

@sathorn6
Copy link

sathorn6 commented Jan 3, 2015

http://codepen.io/anon/pen/GgNmBO

If you start dragging the slider, you cannot stop dragging it in Chrome and it won't stay where you dragged it in Firefox, unless you focussed the game before by clicking on it.

@sathorn6
Copy link
Author

sathorn6 commented Feb 6, 2015

What happens is that the global mouseup handler calls this.game.input.mousePointer.stop(event); here, which then might do a event.preventDefault here:

if (this._stateReset)
{
    event.preventDefault();
    return;
}

Not sure what this code is supposed to do though, so i don't know how to fix it.

@photonstorm
Copy link
Collaborator

If you comment out that line does it actually work for you though?

@sathorn6
Copy link
Author

Yes it does! The problem only occurs after you switch states because it calls .reset() which then sets _stateReset to true.

@photonstorm
Copy link
Collaborator

Right ok.. so basically if you swap states, then touch the Phaser game and THEN drag the slider it should work fine - because that sequence will set _stateReset back to false, stopping the events from being prevented. But if you swap state and then try to drag the slider immediately, it'll fail.

photonstorm added a commit that referenced this issue Feb 11, 2015
…t` was `true`, which is always `true` after a State has changed and before Pointer.start has been called. However this broken interacting with DOM elements in the case where the State changes and you immediately try to use the DOM element without first having clicked on the Phaser game. An additional guard was added so `preventDefault` will now only be called if both `_stateReste` and `Pointer.withinGame` are true (thanks @satan6 #1509)
@photonstorm
Copy link
Collaborator

This is now fixed in dev :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants