what constitues user gesture

六眼飞鱼酱① 提交于 2020-03-03 11:44:09

问题


I recently programmed a menu interface for javascript that lets you dynamically add options to it and mostly works with mouseEnter Events . I thne added some basic video Controls to it with request/exit Fullscreen that trigger on one of these mouseEnter events most of the time it displays Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture. however (weird part :) sometimes it works and im not sure how the browser api decides wether an action is a user gesture or not oO any help would be appreciated thanks


回答1:


Here is the list of events that can trigger "by user activation" as defined by the specs:

  • change
  • click
  • contextmenu
  • dblclick
  • mouseup
  • pointerup
  • reset
  • submit
  • touchend

This is what your error message refers to when they say "a user gesture".

mouseenter is not part of this list.

Most likely, when it worked, it was because one of those event did happen less than a few ms before (IIRC it's 50ms in Chrome currently).



来源:https://stackoverflow.com/questions/56388258/what-constitues-user-gesture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!