breautek commented on issue #81:
URL: 
https://github.com/apache/cordova-plugin-screen-orientation/issues/81#issuecomment-1254415560

   User gestures are trusted events, triggered by the browser on the behalf of 
the user.
   
   Unfortunately, polyfills are not considered trusted user events, because 
they tend to be emitted programmatically, outside of a trusted user event 
callstack. This includes any cordova events because these events, while may 
come from a user gesture, it is coming from outside the browser environment 
from native code, and thus not a trusted user event. This is a browser safety 
mechanism to prevent developers abusing APIs and to give a poor user experience 
that cannot be disabled.
   
   If an API requires a trusted user event/gesture, then it must come from a 
legit click/touch callback (or any native browser event that the user triggers 
and the API must be called without any asynchronous breaks (e.g. using 
`setTimeout` inside a click event will lift the API call from a trusted user 
event callstack and thus will fail the user gesture check).
   
   Closing because this isn't something that can be addressed.
   
   Modern browsers have pretty good support for [screen 
orientations](https://caniuse.com/?search=orientation) so a modern solution 
might be to simply not use this plugin and use the native browser API instead.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to