Pointerlock issues

Hey guys, recently Chrome must have updated and it broke my pointerlock code. I created a PG to show the issue:

Before now, it would toggle pointer lock on/off with ESC or TAB keys. Now, it works fine with TAB, but with ESC it will always exit pointer lock, but it won’t always re-lock. Probably something to do with users pressing ESC so Chrome is blocking future requests.

Any ideas on how to resolve this? And is there an entirely better way to handle this in general?

Indeed, you need to wait for something like 2s before being able to relock again after exiting with ESC.

It does work in Firefox as expected, however. Maybe you can raise the issue on Chrome tracker.