In "Applying the orientation lock" the spec asks the user agent to monitor if the document becomes fully active.
It should also monitor that the pre-lock conditions are retained, and fully unlock if the conditions no longer hold.
There is already provisions in Fullscreen API to fully unlock the screen orientation if full screen exists, but this would be for a more general catch all.