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

Dispatch pointerlockchange and pointerlockerror events to target element, falling back to document. #21

Open
scheib opened this issue May 31, 2017 · 2 comments

Comments

@scheib
Copy link
Contributor

scheib commented May 31, 2017

Pointer Lock intentionally follows the Fullscreen specification patterns. That spec is adopting an event dispatch behavior from the WebKit implementation. whatwg/fullscreen#89

I'm copy pasting the fullscreen text. Logically for pointer lock this will apply to pointerlockchange and pointerlockerror events.

mounirlamouri wrote:

At the moment, my understanding is that fullscreenchange fires on the document while webkitfullscreenchange fires on the element that enters/exits fullscreen and bubbles up to the document.

I see the following reasons to keep the webkitfullscreenchange behaviour:

  • compatibility: likely, some websites that try to assume a non-prefix API will exist add the event listener to the element and simply change the event name. I definitively tried to do that once until @foolip told me I'm wrong;
  • simplicity/less error prone: it will increase the chances of developers to trigger behaviour change when a specific element goes fullscreen instead of anything inside the document (ie. it is easy to not check which element is fullscreen when the document becomes fullscreen).

The only reason I see to fire the event on the document is for the API to be wrapped around the Document interface instead of being spread around multiple interfaces but it's already the case with enterFullscreen() so maybe that battle is already lost?

The compatibility argument doesn't apply, but the simplicity does. Consistency between pointer lock and fullscreen is the most compelling.

@upsuper
Copy link
Member

upsuper commented May 31, 2017

cc myself here.

@scheib
Copy link
Contributor Author

scheib commented Aug 10, 2017

Note: Fullscreen was updated in May. This is just editing & testing work for Pointer Lock at this time (plus, implementations will need to update).

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

No branches or pull requests

2 participants