[HELP] Some web features don't work

I had a need for such a function as elem.requestPointerLock() for some 3D things, but when I tried to use it I found an error DOMException: The root document of this element is not valid for pointer lock.

Who can answer what wrong and what i can do?