HTML5 tries to lock/turn off the mouse cursor on re-entry to viewport

Let me start by saying that for me the most important thing is getting a band-aid fix so I can make my deadline in 3 days.

When I made the project initially, clicking on the viewport would lock the mouse cursor to the viewport and hide it. I prevented this behaviour on my end via code and using 's HTML5 scripts to check if it’s HTML5 and show the mouse cursor.

These issues below occur only in the packaged HTML5 builds. They do NOT occur until re-entry of the cursor to the viewport, meaning that it is resetting all my settings whenever the mouse re-enters, initially, it behaves as intended UNTIL the mouse leaves and re-enters.

There is a setting in Project Settings → Engine → Input → Default Viewport Mouse Capture Mode. I’ve set it to “No Capture”. This is not helping, it is capturing it. It should not be. It is reflected in PIE but not in the packaged HTML5.

This issue is present in Chrome, and I also tested in Microsoft Edge, where the issue would be present but it instead asks me to “Let localhost turn off your mouse pointer?”. It should not be trying to turn off my mouse pointer, I have specifically told it to show it.

My guess is that it’s calling requestPointerLock() when it should not be. Something akin to this:

document.getElementsByTagName("canvas")[0].addEventListener("click", function() {
  this.requestPointerLock();
}, false);

When I create a newly created first person template and change the settings in: Project Settings > Engine > Input > Default Viewport Mouse Capture Mode > No Capture I packaged the project for HTML5 and ran it in a browser locally. When I clicked into the project, a prompt came up saying that the project was set up to hide the cursor and it worked perfectly.

Have you tried this without the code that you included for the requestPointerLock?

Are you working in a Binary or Source version of the engine?

Thanks!

I think you misunderstand, it should not attempt to hide the cursor but it always did regardless of the settings. I never used the code I posted above, I was implying that it seems to be calling something akin to that when it shouldn’t be.

I’ve moved well past this issue and setup my project to work completely differently, so I can’t really troubleshoot this any further.

I see what you’re saying. I’ve found that if you press esc when the prompt shows up, the cursor stays there until you alt-tab again. I made sure to set the viewport properties to “capture permanently” before packaging.

I also ran this by our Developers and they wanted to point out that you can click on the “sites permission” and change it to/from “always allow hiding” and “never allow hiding”.

Thanks!